/* Скелет сайта-инструмента: раскладка, доступность, тёмная тема, телефон. Цвета, шрифты и характер - в tema.css,
   этот файл у всех сайтов сети один и тот же по смыслу, а внешний вид у каждого свой. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); overflow-wrap: anywhere; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 3px; }
img, svg, video { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* шапка и подвал */
.top { padding: 14px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 22px/1 var(--font-display); letter-spacing: .005em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: 15px; }
.top nav a { color: var(--ink); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { border-bottom-color: var(--accent); }
.bottom { margin-top: 48px; padding: 22px 0 32px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.bottom .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.bottom ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; }
.bottom p { margin: 0; }
.bottom a, .bottom button { color: inherit; }
.bottom button { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* переключатель темы: солнце в светлой, луна в тёмной (та же пара условий, что у цветов в tema.css) */
.tema-knopka { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.tema-knopka:hover { border-color: var(--line-strong); }
.tema-knopka svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tema-knopka .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tema-knopka .sun { display: none; } :root:not([data-theme="light"]) .tema-knopka .moon { display: block; } }
:root[data-theme="dark"] .tema-knopka .sun { display: none; }
:root[data-theme="dark"] .tema-knopka .moon { display: block; }

/* текст */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(32px, 5.5vw, 54px); max-width: 18em; }
h2 { font-size: clamp(24px, 3.2vw, 32px); margin: 40px 0 10px; }
h3 { font-size: 20px; margin: 24px 0 6px; }
p { margin: 0 0 14px; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 48em; margin: 10px 0 0; }
.prose { padding-bottom: 8px; }
.prose p, .prose li { max-width: 72ch; }
.prose li { margin-bottom: 6px; }
.prose table { border-collapse: collapse; width: 100%; margin: 8px 0 18px; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose code, .mono { font-family: var(--font-mono); font-size: .93em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; font-size: 14px; }
.prose pre code { background: none; padding: 0; }
.foot-note, .hint, .small { font-size: 14px; color: var(--muted); }
.date { font-size: 14px; color: var(--muted); margin: 10px 0 24px; }

/* первый экран */
.hero { padding: 26px 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 14px; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }

/* инструмент */
.tool { padding: 10px 0 8px; }
/* ввод слева, результат справа (правило сети: результат всегда на виду); на телефоне - друг под другом */
.tool-grid { display: grid; gap: 16px; }
.tool-grid .out { min-height: 160px; }
.tool-grid .placeholder { margin: 0; color: var(--muted); }
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .tool-grid .out { position: sticky; top: 16px; }
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 180px; padding: 24px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-visible, .drop.is-over { border-color: var(--accent); background: var(--surface-2); }
.drop p { margin: 0; }
.drop .link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-s); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn:disabled { opacity: .5; cursor: default; }
.mini { font-size: 13px; padding: 4px 10px; min-height: 30px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.status { min-height: 1.5em; margin: 12px 0 0; font-size: 15px; }
.status.is-error { color: var(--bad); }
.result { margin-top: 16px; }
.result .panel { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field label { font-weight: 600; font-size: 15px; }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); max-width: 100%; }
.field textarea { min-height: 140px; font-family: var(--font-mono); font-size: 16px; } /* меньше 16 px - iPhone увеличивает страницу при касании */
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid var(--link); outline-offset: 1px; border-color: transparent; }
.form .field:last-of-type { margin-bottom: 16px; }
.form .row .btn { flex: none; }

/* как это работает */
.how { padding: 8px 0; }
.steps { list-style: none; counter-reset: shag; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.steps li { counter-increment: shag; position: relative; padding: 16px 16px 16px 56px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(shag); position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 14px/1 var(--font-display); }
.steps b { display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 17px; }

/* вопросы */
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 17px; padding: 6px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font: 400 22px/1 var(--font-display); flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq details p { max-width: 70ch; }

/* рекламное место: пока выключено, места не занимает */
aside[data-ad] { margin: 24px 0; padding: 12px; min-height: 100px; border: 1px dashed var(--line); font-size: 12px; color: var(--muted); text-align: center; }

/* 404 */
.lost { padding: 72px 0 40px; }

@media (max-width: 640px) {
  .hero { padding: 20px 0 10px; }
  .panel { padding: 14px; }
  .drop { min-height: 150px; padding: 18px; }
  .steps li { padding-left: 52px; }
  .mini { min-height: 40px; padding: 8px 12px; }
}
/* печать: отчёт на всю ширину, светлая (тёмная тема в tema.css только screen) */
@media print {
  .top nav, .bottom, aside[data-ad], .drop, .form .row { display: none !important; }
  .tool-grid { display: block; }
  .tool-grid .out { position: static; }
  .tool-grid > * + * { margin-top: 16px; }
  :root:root:root { color-scheme: light; }
}
