/* ============================================================
   Mine Media Tools — единый файл стилей
   Структура: переменные → база → раскладка → компоненты →
   страницы → адаптивность
   ============================================================ */

/* ---------- 1. Переменные ---------- */
:root {
  --bg: #0c0f13;
  --bg-soft: #11161d;
  --panel: #151c25;
  --panel-2: #1b2431;
  --line: #243040;
  --line-soft: #1c2532;
  --text: #e9eff7;
  --muted: #8fa1b8;
  --accent: #3fd6bd;
  --accent-2: #7d8cff;
  --warn: #ffb347;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 14px 34px rgba(0, 0, 0, .38);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1180px;
}

/* ---------- 2. База ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, canvas { max-width: 100%; }
canvas { display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .18s ease, opacity .18s ease;
}
a:hover { color: #6ff0da; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.1vw, 2rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.15em; }
li { margin-bottom: .35em; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: .1em .4em;
  color: #b9c8dc;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #04110f;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; color: #04110f; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 3. Раскладка ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 20px;
}

.section { padding: 68px 0; }
.section--alt {
  background: var(--bg-soft);
  border-block: 1px solid var(--line-soft);
}

.section__head { max-width: 720px; margin-bottom: 32px; }
.section__sub { color: var(--muted); margin: 0; }

.page-head { padding: 56px 0 8px; }
.page-head .lead { max-width: 760px; }

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 12px;
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(63, 214, 189, .1);
  border: 1px solid rgba(63, 214, 189, .25);
  border-radius: 999px;
}

.lead { font-size: 1.08rem; color: #c4d2e2; }
.muted { color: var(--muted); }

/* ---------- 4. Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 15, 19, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.logo:hover { color: var(--text); }
.logo img { width: 28px; height: 28px; }
.logo__accent { color: var(--accent); }

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .95rem;
  transition: background .18s ease, color .18s ease;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--accent); background: rgba(63, 214, 189, .09); }

.burger {
  display: none;
  margin-left: auto;
  width: 42px; height: 42px;
  padding: 11px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.burger span + span { margin-top: 5px; }

/* ---------- 5. Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #2fb9a4);
  color: #04110f;
}
.btn--primary:hover { color: #04110f; background: linear-gradient(135deg, #57e6cf, #34c9b1); }

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--small { padding: 7px 14px; font-size: .85rem; margin-top: 12px; }

/* ---------- 6. Hero ---------- */
.hero {
  padding: 64px 0 36px;
  background:
    radial-gradient(900px 420px at 78% -10%, rgba(125, 140, 255, .16), transparent 70%),
    radial-gradient(700px 360px at 8% 0%, rgba(63, 214, 189, .12), transparent 70%);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 48px;
  align-items: center;
}

.hero__text h1 { margin-bottom: .45em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 30px; }

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hero__stats li { margin: 0; display: flex; flex-direction: column; }
.hero__stats strong { font-size: 1.42rem; color: var(--accent); line-height: 1.2; }
.hero__stats span { font-size: .86rem; color: var(--muted); }

.hero__art img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, .5));
}

/* ---------- 7. Карточки ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 24px;
}

.grid { display: grid; gap: 20px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.feature h3 { color: var(--accent); }
.feature p:last-child { margin-bottom: 0; }

.prose h2, .prose h3 { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose ul { color: #c4d2e2; }

/* ---------- 8. Формы ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }

.field label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .18s ease, background .18s ease;
  appearance: none;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: #0f151c;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 1px),
    calc(100% - 13px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field--actions { justify-content: flex-end; }

/* ---------- 9. Калькулятор ---------- */
.calc {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 20px;
  align-items: start;
}

.calc__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.calc__result {
  display: grid;
  gap: 18px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
}

.metric { display: flex; flex-direction: column; gap: 2px; }
.metric__label { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.metric__value {
  font-family: var(--mono);
  font-size: 1.72rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.15;
}
.metric__unit { font-size: .82rem; color: var(--muted); }

.calc__hint {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: .9rem;
  color: #c4d2e2;
}
.calc__disclaimer { margin: 0; font-size: .78rem; color: var(--muted); }

/* ---------- 10. Фильтры ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 28px;
}

.chip {
  padding: 8px 16px;
  font: inherit;
  font-size: .88rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chip:hover { color: var(--text); border-color: #33445a; }
.chip.is-active {
  color: #04110f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- 11. Карточки ассетов ---------- */
.asset-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.asset-card:hover {
  border-color: #2f4055;
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.asset-card__thumb { background: #0f141b; border-bottom: 1px solid var(--line-soft); }
.asset-card__thumb canvas { width: 100%; height: auto; }

.asset-card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.asset-card__body h3 { margin-bottom: .45em; font-size: 1.02rem; }
.asset-card__body p { font-size: .9rem; color: var(--muted); flex: 1; }

.asset-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  font-family: var(--font);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(125, 140, 255, .12);
  border: 1px solid rgba(125, 140, 255, .28);
  border-radius: 999px;
}

.catalog__more { margin: 32px 0 0; }

/* ---------- 12. Страница инструментов ---------- */
.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.tool__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}

.tool__out h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tool__note { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

.code-out {
  margin: 0;
  padding: 16px;
  max-height: 320px;
  overflow: auto;
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.75;
  color: #b9e8df;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  white-space: pre;
}

.result-big {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 16px;
}

.aspect-canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

/* ---------- 13. Таблицы ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}
.table-wrap--mt { margin-top: 20px; }

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: .92rem;
}

.table th,
.table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  background: var(--panel-2);
  white-space: nowrap;
}

.table tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.table tbody tr:last-child th,
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .02); }

/* ---------- 14. Модальное окно ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 9, .78);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal__dialog h3 { margin-bottom: 16px; padding-right: 44px; }
.modal__dialog canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
}

.modal__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}
.modal__close:hover { color: var(--text); border-color: var(--accent); }

.modal__note { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }
.modal__actions { margin-top: 16px; }

/* ---------- 15. Подвал ---------- */
.site-footer {
  margin-top: 40px;
  padding-top: 48px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line-soft);
  font-size: .9rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr;
  gap: 36px;
  padding-bottom: 36px;
}

.footer__note { color: var(--muted); margin: 16px 0 0; max-width: 40ch; }

.footer__col h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 14px;
}

.footer__col ul { list-style: none; padding: 0; margin: 0; }
.footer__col li { margin-bottom: .5em; }
.footer__col a { color: #c4d2e2; }
.footer__col a:hover { color: var(--accent); }

.footer__tech li { color: var(--muted); }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-block: 20px 28px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .84rem;
}
.footer__bottom p { margin: 0; }

/* ---------- 16. Адаптивность ---------- */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; gap: 32px; }
  .hero__art { order: -1; max-width: 420px; }
  .calc { grid-template-columns: 1fr; }
  .tool { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .section { padding: 48px 0; }
  .page-head { padding: 36px 0 0; }

  .burger { display: block; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 10px 16px 18px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 18px 30px rgba(0, 0, 0, .45);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1rem; }

  .site-header__inner { position: relative; flex-wrap: nowrap; }

  .hero { padding-top: 40px; }
  .hero__stats { gap: 22px; }
  .hero__stats strong { font-size: 1.2rem; }

  .footer__grid { grid-template-columns: 1fr; gap: 28px; }
  .footer__bottom { flex-direction: column; }
}

@media (max-width: 420px) {
  .container { padding-inline: 16px; }
  .card { padding: 18px; }
  .metric__value { font-size: 1.45rem; }
}

/* ---------- 17. Уважение к настройкам пользователя ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}