/* /fonts/styles.css — стили страницы «Шрифты для презентаций».
   Школьная тема (design-systems/school.md + _base.md): SF Pro, фон #f2f2fa, белые карточки,
   радиусы 14/20/28, моноакцент #ff383b. Раскладка по образцу Google Fonts (2026-10-12):
   слева липкая панель настроек, справа список, где каждый шрифт показан фразой. */

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

:root {
  --page: #f2f2fa;
  --card: #ffffff;
  --ink: #151515;
  --muted: #66666f;
  --quiet: #afafb5;
  --line: rgba(21, 21, 21, 0.09);
  --field: #e2e2ee;
  --accent: #ff383b;
  --radius-md: 14px;
  --radius-card: 20px;
  --radius-pill: 999px;
  --gutter: 32px;
}
@media (max-width: 640px) { :root { --gutter: 16px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* Контейнер выровнен по общей шапке: max-width 1640px, боковые отступы --gutter */
main { max-width: 1640px; margin: 0 auto; padding: 0 var(--gutter) 92px; }

/* ---------- hero ---------- */
.hero { padding: 44px 0 26px; max-width: 1120px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 14px; font-weight: 700; }
.hero h1 {
  margin: 0;
  font-size: clamp(36px, 4.6vw, 64px);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.hero__lead { max-width: 710px; margin: 16px 0 0; color: #52525a; font-size: 18px; line-height: 1.48; }

/* ---------- две колонки: панель + список ---------- */
.fp-layout { display: flex; gap: 24px; align-items: flex-start; }
.fp-panel {
  width: 300px;
  flex: 0 0 300px;
  position: sticky;
  top: 76px;               /* общая sticky-шапка: 10px отступ + пилюля 50px + зазор */
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.fp-content { flex: 1; min-width: 0; --fp-size: 36px; }

.fp-ctl { display: grid; gap: 10px; }
.fp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.fp-row output { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.fp-reset {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.fp-reset:hover { text-decoration: underline; text-underline-offset: 3px; }
.fp-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 12px 14px;
  border: 1.5px solid var(--field);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
}
.fp-textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type="range"] { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.fp-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-seg button {
  padding: 8px 12px;
  border: 1px solid rgba(21, 21, 21, .12);
  border-radius: var(--radius-pill);
  background: #fff;
  color: #52525a;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.fp-seg button:hover { border-color: rgba(255, 56, 59, .45); color: var(--accent); }
.fp-seg button.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fp-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fp-note { margin: 0; color: #85858e; font-size: 12px; line-height: 1.45; }

/* ---------- секции и заголовки ---------- */
.font-section { padding: 6px 0 24px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 2px 12px; }
.section-heading h2 { margin: 0; color: var(--quiet); font-size: 24px; line-height: 1.15; letter-spacing: -.02em; }
.section-heading span { color: #85858e; font-size: 14px; white-space: nowrap; }

/* ---------- карточка-строка ---------- */
.font-card {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  scroll-margin-top: 80px;   /* якорь /fonts/#slug — под липкой шапкой */
}
.font-card + .font-card, .font-card + .font-promo, .font-promo + .font-card { margin-top: 10px; }

.font-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 0;
  cursor: pointer;
}
.font-card__identity { min-width: 0; }
.font-card__identity h3 { margin: 0; font-size: 17px; line-height: 1.2; font-weight: 700; }
.font-card__identity p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.font-card__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.license-badge {
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: #f0f0f4;
  color: #5c5c65;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.license-badge:hover { background: #e5e5eb; color: var(--ink); }
.license-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.download-button {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .2s ease, transform .2s ease;
}
.download-button:hover { background: var(--ink); transform: translateY(-1px); }
.download-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.font-card__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.font-card__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-label::before { content: "Настроить"; }
.font-card.is-open .toggle-label::before { content: "Свернуть"; }
.toggle-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0;
  transition: transform .2s ease, background .2s ease;
}
.toggle-icon::before, .toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.toggle-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.font-card.is-open .toggle-icon { transform: rotate(45deg); background: var(--accent); }

/* Превью: размер — из панели (переменная --fp-size на .fp-content) */
.font-card__preview {
  margin: 0;
  padding: 14px 24px 22px;
  font-size: var(--fp-size, 36px);
  line-height: 1.12;
  min-height: calc(var(--fp-size, 36px) * 1.12 + 36px); /* в HTML превью пустое, текст ставит JS — без прыжка вёрстки */
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.font-card:not(.is-font-ready) .font-card__preview { color: #8e8e96; }  /* пока шрифт не пришёл — системный, приглушённо */
.font-card__font-status { display: block; padding: 0 24px 14px; color: #b0b0b7; font-size: 12px; }
.font-card__font-status:empty { display: none; }
.font-card.has-font-error .font-card__font-status { color: var(--accent); }

.font-card__body { border-top: 1px solid var(--line); }
.font-card__body[hidden] { display: none; }
.font-card__controls {
  display: grid;
  grid-template-columns: repeat(var(--controls-count, 3), minmax(0, 1fr));
  gap: 24px;
  padding: 20px 24px 22px;
  border-bottom: 1px solid var(--line);
}
.font-control { display: grid; gap: 10px; }
.font-control > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.font-control b { color: var(--ink); font-weight: 650; }
.font-control output { font-variant-numeric: tabular-nums; }
.style-select {
  width: 100%;
  min-height: 44px;
  padding: 0 42px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.style-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.font-card__footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 24px 18px; }
.font-card__meta { display: flex; gap: 8px; flex-wrap: wrap; }
.font-card__meta span { padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted); font-size: 13px; }

/* ---------- окно лицензии ---------- */
.license-dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(20 20 24 / 18%);
}
.license-dialog::backdrop { background: rgb(25 25 31 / 42%); }
.license-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.license-dialog__header h2 { margin: 0; font-size: 24px; line-height: 1.15; }
.license-dialog__close {
  display: grid; flex: none; width: 32px; height: 32px; padding: 0 0 2px; place-items: center;
  border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 700; line-height: 1; cursor: pointer;
}
.license-dialog__close:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.license-dialog__description { margin: 0; padding: 22px 24px 12px; font-size: 17px; line-height: 1.5; }
.license-dialog__credit { margin: 4px 24px 18px; padding: 16px; border-radius: 16px; background: #f5f5f8; }
.license-dialog__author { display: grid; gap: 4px; margin: 0; font-size: 15px; }
.license-dialog__attribution { display: grid; gap: 8px; margin-top: 14px; font-size: 14px; }
.license-dialog__attribution code { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-family: inherit; line-height: 1.4; }
.license-dialog__credit[hidden], .license-dialog__author[hidden], .license-dialog__attribution[hidden] { display: none; }
.license-dialog__note { margin: 0; padding: 0 24px 20px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.license-dialog__link { display: block; margin: 0 24px 24px; padding: 13px 18px; border-radius: var(--radius-pill); background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; text-align: center; }
.license-dialog__link:hover { background: #e92333; }
.license-dialog__link[hidden] { display: none; }

/* ---------- промо Telegram в списке (рисует createTgPromo в app.js) ---------- */
.font-promo {
  --tg-blue: #2481cc;
  --tg-blue-hover: #1d6fb3;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 24px;
  border-radius: var(--radius-card);
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.55' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M14 34l28-12-10 26-5-9z'/%3E%3Cpath d='M98 100l28-12-10 26-5-9z'/%3E%3Ccircle cx='124' cy='30' r='5'/%3E%3Ccircle cx='36' cy='124' r='4'/%3E%3Cpath d='M70 64c-2-4-9-4-9 1 0 5 9 10 9 10s9-5 9-10c0-5-7-5-9-1z'/%3E%3Cpath d='M136 136l6-6M142 136l-6-6'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #d3ebcf 0%, #b3dcd3 48%, #a1cbe6 100%);
  background-size: 160px 160px, auto;
  transition: transform .2s ease, box-shadow .25s ease;
}
.font-promo:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(36, 129, 204, .18); }
.font-promo:focus-visible { outline: 2px solid var(--tg-blue); outline-offset: 3px; }
.font-promo__who { display: grid; gap: 12px; justify-items: start; }
.font-promo__label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .8); color: var(--tg-blue); font-size: 13px; font-weight: 600; }
.font-promo__label svg, .font-promo__btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.font-promo__head { display: flex; align-items: center; gap: 12px; }
.font-promo__avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; object-fit: cover; box-shadow: 0 0 0 2px #fff; }
.font-promo__meta { display: flex; flex-direction: column; min-width: 0; }
.font-promo__name { font-size: 15px; font-weight: 700; line-height: 1.25; }
.font-promo__subs { font-size: 13px; color: #3f5566; margin-top: 2px; }
.font-promo__chat { display: grid; gap: 6px; padding-left: 8px; max-width: 620px; }
.font-promo__bubble { position: relative; justify-self: start; max-width: 100%; background: #fff; border-radius: 16px; padding: 10px 13px; font-size: 14px; line-height: 1.45; box-shadow: 0 1px 1.5px rgba(16, 35, 47, .14); }
.font-promo__bubble-title { display: block; font-weight: 700; margin-bottom: 4px; }
.font-promo__bubble--last { border-bottom-left-radius: 4px; }
.font-promo__bubble--last::before {
  content: ""; position: absolute; left: -8px; bottom: 0; width: 9px; height: 17px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='17' viewBox='0 0 9 17'%3E%3Cpath d='M9 0v17H0c3.2-.5 5.4-1.4 6.5-2.9C8 12.2 8.6 8.1 9 0z' fill='%23fff'/%3E%3C/svg%3E") no-repeat;
}
.font-promo__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: var(--radius-pill); background: var(--tg-blue); color: #fff; font-size: 15px; font-weight: 700; white-space: nowrap; transition: background .15s ease; }
.font-promo:hover .font-promo__btn { background: var(--tg-blue-hover); }

/* ---------- текстовые блоки под каталогом ---------- */
.font-texts { display: grid; gap: 40px; max-width: 780px; margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.font-text { display: grid; gap: 14px; }
.font-text h2 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.font-text p, .font-text li { margin: 0; color: #3a3a40; font-size: 17px; line-height: 1.55; }
.font-text ol, .font-text ul { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.font-text a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(255, 56, 59, .5); text-underline-offset: 3px; }
.font-text a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.font-text code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

/* ---------- адаптив ---------- */
@media (max-width: 1024px) {
  .fp-layout { flex-direction: column; }
  .fp-panel { position: static; width: auto; flex: none; max-height: none; }
  .fp-content { width: 100%; }
  .font-promo { grid-template-columns: minmax(0, 1fr) auto; }
  .font-promo__chat { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 760px) {
  main { padding-bottom: 56px; }
  .hero { padding: 28px 0 20px; }
  .hero__lead { margin-top: 12px; font-size: 16px; }
  .fp-panel { padding: 16px; gap: 14px; }
  .fp-textarea { min-height: 72px; }
  .font-card__header { flex-wrap: wrap; gap: 12px; padding: 16px 16px 0; }
  .font-card__actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .font-card__preview { padding: 12px 16px 18px; }
  .font-card__font-status { padding: 0 16px 12px; }
  .font-card__controls { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px; }
  .font-card__footer { padding: 12px 16px 16px; }
  .font-promo { grid-template-columns: 1fr; gap: 16px; padding: 18px 16px 16px; }
  .font-promo__btn { width: 100%; }
  .license-dialog__header { padding: 20px 18px 16px; }
  .license-dialog__header h2 { font-size: 21px; }
  .license-dialog__description { padding: 18px 18px 10px; font-size: 16px; }
  .license-dialog__credit { margin: 4px 18px 16px; padding: 14px; }
  .license-dialog__note { padding: 0 18px 18px; }
  .license-dialog__link { margin: 0 18px 18px; }
  .font-texts { margin-top: 40px; padding-top: 28px; gap: 30px; }
  .font-text h2 { font-size: 22px; }
  .font-text p, .font-text li { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
