/* dims.one — сайт Dimensions. Цвета и шрифты — как в приложении
   (lib/core/theme/app_theme.dart): тёмный фон, акцент 68427F, Roboto,
   плоские плитки без скругления. */

@font-face {
  font-family: 'Roboto';
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/Roboto-Light.ttf') format('truetype');
}
@font-face {
  font-family: 'Roboto';
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Roboto-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Roboto';
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/Roboto-Medium.ttf') format('truetype');
}

:root {
  --bg: #0b0b0d;
  --surface: rgba(32, 32, 38, 0.82);
  --surface-hover: rgba(44, 44, 52, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #68427f;
  --accent-hover: #7a4f95;
  --accent-text: #b48fd0;
  --text: #ffffff;
  --text-2: #b0b0b0;
  --text-3: #888888;
  --gap: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
  font-size: 17px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }

.lang { display: flex; gap: 2px; }
.lang button {
  background: none;
  border: 0;
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  cursor: pointer;
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed='true'] { color: var(--accent-text); }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.hero .logo { width: 112px; height: 112px; margin-bottom: 28px; }

h1 {
  font-weight: 300;
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}
.page-title { font-size: 32px; margin: 8px 0 24px; }

.lead { font-size: 20px; font-weight: 300; color: var(--text); margin: 0 0 8px; }
.sub { color: var(--text-2); margin: 0 0 32px; max-width: 520px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  font: 500 14px/1 'Roboto', system-ui, sans-serif;
  border: 1.5px solid var(--accent);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn.secondary { background: transparent; border-color: var(--accent); color: var(--text); }
.btn.secondary:hover { background: rgba(104, 66, 127, 0.25); }
.btn[aria-disabled='true'] {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
  color: var(--text-3);
  pointer-events: none;
}

.tiles { display: grid; gap: var(--gap); }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 20px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tile .icon {
  grid-row: span 3;
  width: 48px;
  height: 48px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile .icon svg { width: 26px; height: 26px; fill: #fff; }
.tile.muted .icon { background: rgba(255, 255, 255, 0.08); }
.tile.muted .icon svg { fill: var(--text-3); }
.tile h2 { margin: 0; font-size: 17px; font-weight: 500; line-height: 48px; }
.tile .meta { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }
.tile .body { grid-column: 2; }
.tile .row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.tile .note { color: var(--text-3); font-size: 12px; margin: 12px 0 0; }

details { margin-top: 12px; color: var(--text-3); font-size: 12px; }
details summary { cursor: pointer; }
details code {
  display: block;
  margin-top: 6px;
  font: 12px/1.4 ui-monospace, 'Noto Sans Mono', monospace;
  color: var(--text-2);
  word-break: break-all;
  user-select: all;
}

.foot {
  padding: 24px;
  color: var(--text-3);
  font-size: 12px;
  display: grid;
  gap: 8px;
}
.foot nav, .foot p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  margin: 0;
}
.foot nav a { color: var(--text-2); font-size: 13px; }
.foot a { color: var(--text-3); }
.foot a:hover { color: var(--text); }

/* Документы (/privacy, /terms, /glossary, /changelog): tool/build_site.dart */
.doc-page { max-width: 800px; }
.doc-note { color: var(--text-3); font-size: 13px; margin: 0 0 12px; }
.doc {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px 32px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-2);
  overflow-wrap: break-word;
}
.doc h1 { font-size: 32px; color: var(--text); margin: 0 0 16px; }
.doc h2 { font-size: 20px; font-weight: 500; color: var(--text); margin: 32px 0 12px; }
.doc h3 { font-size: 17px; font-weight: 500; color: var(--text); margin: 24px 0 8px; }
.doc h2, .doc h3 { scroll-margin-top: 16px; }
.doc p, .doc li { font-size: 15px; line-height: 1.6; }
/* абзацы в исходниках — одной строкой; перенос внутри — намеренный (даты) */
.doc p { white-space: pre-line; }
.doc strong { color: var(--text); font-weight: 500; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.doc code { font: 13px ui-monospace, 'Noto Sans Mono', monospace; color: var(--text); }
.doc blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--accent); }
.table-wrap { overflow-x: auto; margin: 16px 0; }
.doc table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { color: var(--text); font-weight: 500; background: rgba(255, 255, 255, 0.04); }
.doc .toc { margin: 0 0 8px; color: var(--text-2); font-size: 15px; }
.doc .toc summary { color: var(--text); font-weight: 500; }
.doc .toc ol { list-style: none; padding-left: 0; margin: 8px 0 0; }
.doc .toc li { margin: 2px 0; font-size: 14px; }

/* Статьи /<lang>/articles/ (tool/build_site.dart): переключатель языка —
   ссылки на версии страницы, дата и время чтения, схемы, призыв в конце */
.lang a {
  color: var(--text-3);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 6px 8px;
}
.lang a:hover { color: var(--text); text-decoration: none; }
.lang a[aria-current='true'] { color: var(--accent-text); }
.hero .more { margin-top: 24px; font-size: 14px; }
.post h2 { margin-top: 36px; }
.post .post-meta { color: var(--text-3); font-size: 13px; margin: -8px 0 20px; white-space: normal; }
.post h1 + .post-meta + p, .post .post-lead { color: var(--text); font-size: 17px; }
.doc .post-list { list-style: none; padding: 0; margin: 24px 0 0; }
.doc .post-list li { margin: 0; padding: 16px 0; border-top: 1px solid var(--line); }
.post-list a { color: var(--text); font-size: 19px; font-weight: 500; }
.doc .post-list p { margin: 6px 0 0; }
.doc .post-list .post-meta { margin: 6px 0 0; }

.fig {
  margin: 24px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.fig figcaption {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
.fig b { display: block; color: var(--text); font-weight: 500; }
.fig span { display: block; color: var(--text-2); font-size: 14px; line-height: 1.5; }

/* flow: шаги на вертикальной линии, номер в квадрате (плитки без скругления) */
.fig-flow ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.fig-flow li { counter-increment: step; position: relative; margin: 0; padding: 0 0 18px 48px; }
.fig-flow li:last-child { padding-bottom: 0; }
.fig-flow li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font: 500 14px/32px 'Roboto', system-ui, sans-serif;
  text-align: center;
}
.fig-flow li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: rgba(180, 143, 208, 0.35);
}
.fig-flow li b { line-height: 32px; }

/* compare: два способа рядом, правый — акцентом */
.fig-compare table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fig-compare th, .fig-compare td {
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.fig-compare thead th, .fig-compare thead td { border-top: 0; }
.fig-compare thead th { color: var(--text); font-weight: 500; }
.fig-compare thead th:last-child { color: var(--accent-text); }
.fig-compare tbody th { width: 24%; color: var(--text-3); font-weight: 400; }
.fig-compare tbody td { color: var(--text-2); }
.fig-compare td:last-child, .fig-compare thead th:last-child { background: rgba(104, 66, 127, 0.18); }
.fig-compare tbody td:last-child { color: var(--text); }

/* tree: аккаунт сверху, профили измерений — отдельными плитками под ним */
.fig-tree .root {
  max-width: 360px;
  margin: 0 auto;
  padding: 12px 16px;
  background: var(--accent);
  text-align: center;
}
.fig-tree .root span { color: rgba(255, 255, 255, 0.8); font-size: 13px; }
.fig-tree ul {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.fig-tree ul::before, .fig-tree ul::after, .fig-tree li::before {
  content: '';
  position: absolute;
  border: 0 solid rgba(180, 143, 208, 0.35);
}
.fig-tree ul::before { top: 0; left: 50%; height: 12px; border-left-width: 2px; }
.fig-tree ul::after { top: 12px; left: calc((100% - 24px) / 6); right: calc((100% - 24px) / 6); border-top-width: 2px; }
.fig-tree li {
  position: relative;
  margin: 0;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
}
.fig-tree li::before { top: -13px; left: 50%; height: 12px; border-left-width: 2px; }
.fig-tree .note { margin: 14px 0 0; color: var(--accent-text); font-size: 13px; text-align: center; white-space: normal; }

.post .cta {
  margin: 36px 0 0;
  padding: 24px;
  background: rgba(104, 66, 127, 0.22);
  border: 1px solid rgba(180, 143, 208, 0.25);
  text-align: center;
}
.post .cta p { color: var(--text); font-size: 18px; font-weight: 300; margin: 0 0 16px; white-space: normal; }

@media (max-width: 520px) {
  .top { padding: 12px 16px; }
  main { padding: 16px; }
  h1 { font-size: 32px; }
  .page-title { font-size: 26px; }
  .lead { font-size: 18px; }
  .tile { grid-template-columns: 40px 1fr; padding: 16px; }
  .tile .icon { width: 40px; height: 40px; }
  .tile h2 { line-height: 40px; }
  .actions .btn { flex: 1 1 100%; }
  .doc { padding: 20px 12px; }
  .doc h1 { font-size: 26px; }
  .doc h2 { font-size: 18px; }
  /* колонки поровну: длинные узбекские слова не растягивают таблицу шире экрана */
  .doc table { font-size: 13px; table-layout: fixed; width: 100%; }
  .doc th, .doc td { padding: 6px 8px; hyphens: auto; overflow-wrap: break-word; }
  .fig { padding: 16px 12px; }
  .post .cta { padding: 20px 12px; }
  /* compare: строка — заголовок во всю ширину, под ним два способа */
  .fig-compare table, .fig-compare thead, .fig-compare tbody { display: block; }
  .fig-compare tr { display: grid; grid-template-columns: 1fr 1fr; }
  .fig-compare thead td { display: none; }
  .fig-compare th, .fig-compare td { padding: 8px; }
  .fig-compare tbody th { grid-column: 1 / -1; width: auto; padding-bottom: 0; }
  .fig-compare tbody td { border-top: 0; }
  /* tree: профили столбиком, от аккаунта — одна линия */
  .fig-tree ul { grid-template-columns: 1fr; }
  .fig-tree ul::after, .fig-tree li::before { display: none; }
}
