/* Оформление раздачи дистрибутивов FastOffices.
 *
 * Разметку рисует index.js самого dufs — здесь только вид. Классы, на которые
 * опирается этот файл (.paths-table, .cell-name, .cell-mtime, .cell-size,
 * .cell-actions, .breadcrumb), приходят оттуда, переименовывать их нельзя.
 */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f7f5f2;
  --text: #1e1919;
  --text-muted: #6f6f6f;
  --text-faint: #9a9a9a;
  --line: #eceae6;
  --line-strong: #dcd9d3;
  --accent: #0061ff;
  --accent-soft: #e8f0ff;
  --row-height: 56px;
}

/* Тема: по умолчанию системная; человек может зафиксировать светлую или
   тёмную кнопкой в шапке — тогда на html появляется data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191817;
    --surface: #191817;
    --surface-hover: #242220;
    --text: #f7f5f2;
    --text-muted: #a8a29a;
    --text-faint: #7a746c;
    --line: #2b2926;
    --line-strong: #3a3733;
    --accent: #6ea8ff;
    --accent-soft: #1d2a40;
  }
}

:root[data-theme="dark"] {
    --bg: #191817;
    --surface: #191817;
    --surface-hover: #242220;
    --text: #f7f5f2;
    --text-muted: #a8a29a;
    --text-faint: #7a746c;
    --line: #2b2926;
    --line-strong: #3a3733;
    --accent: #6ea8ff;
    --accent-soft: #1d2a40;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── шапка ─────────────────────────────────────────────────────────── */

.head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.brand svg {
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.breadcrumb a {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.breadcrumb a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.breadcrumb b {
  padding: 2px 6px;
  font-weight: 600;
}

.breadcrumb .separator {
  color: var(--text-faint);
  font-weight: 400;
}

/* ── панель инструментов ───────────────────────────────────────────── */

.toolbox,
.toolbox-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbox-right {
  margin-left: auto;
}

.control,
.login-btn,
.logout-btn,
.save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.control:hover,
.login-btn:hover,
.logout-btn:hover,
.save-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.control svg,
.login-btn svg,
.logout-btn svg,
.save-btn svg {
  fill: currentColor;
}

.hidden {
  display: none !important;
}

/* ── поиск ─────────────────────────────────────────────────────────── */

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
  max-width: 320px;
  flex: 1;
}

.searchbar .icon {
  position: absolute;
  left: 12px;
  display: flex;
  color: var(--text-faint);
  pointer-events: none;
}

.searchbar .icon svg {
  fill: currentColor;
}

.searchbar input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.searchbar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── список файлов ─────────────────────────────────────────────────── */

.main {
  padding: 8px 20px 64px;
}

.paths-table {
  width: 100%;
  border-collapse: collapse;
}

.paths-table thead th {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.paths-table thead th a {
  color: inherit;
}

.paths-table thead th a:hover {
  color: var(--text);
}

.paths-table thead .cell-size,
.paths-table tbody .cell-size {
  text-align: right;
}

.paths-table tbody tr {
  height: var(--row-height);
  border-bottom: 1px solid var(--line);
  transition: background 0.1s ease;
}

.paths-table tbody tr:hover {
  background: var(--surface-hover);
}

.paths-table td {
  padding: 0 12px;
  vertical-align: middle;
}

.cell-icon {
  width: 44px;
  padding-left: 12px !important;
  padding-right: 0 !important;
}

.cell-icon svg {
  display: block;
  width: 28px;
  height: 28px;
}

.cell-name {
  max-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-name a {
  font-size: 15px;
  color: var(--text);
}

.cell-name a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* каталоги набираются плотнее — так дерево читается с одного взгляда */
tr.is-dir .cell-name a {
  font-weight: 600;
}

.cell-mtime,
.cell-size {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-mtime {
  width: 200px;
}

.cell-size {
  width: 110px;
}

/* ── действия в строке ─────────────────────────────────────────────── */

.cell-actions {
  width: 1%;
  white-space: nowrap;
}

.cell-actions .action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 2px;
  border-radius: 8px;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.paths-table tbody tr:hover .action-btn {
  opacity: 1;
}

.cell-actions .action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.cell-actions .action-btn svg {
  fill: currentColor;
}

/* на сенсорных экранах наведения нет — показываем действия сразу */
@media (hover: none) {
  .cell-actions .action-btn {
    opacity: 1;
  }
}

/* ── пустой каталог и загрузка ─────────────────────────────────────── */

.empty-folder {
  padding: 80px 16px;
  color: var(--text-faint);
  font-size: 15px;
  text-align: center;
}

.uploaders-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.uploaders-table th {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

.uploaders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.upload-status {
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

.retry-btn {
  margin-left: 8px;
  color: var(--accent);
  cursor: pointer;
}

/* ── просмотр и правка файла ───────────────────────────────────────── */

.editor,
.not-editable {
  width: 100%;
  min-height: 70vh;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.editor:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── узкий экран ───────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .head {
    padding: 14px 16px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .brand {
    padding-right: 12px;
  }

  .breadcrumb {
    font-size: 17px;
  }

  .searchbar {
    order: 3;
    max-width: none;
    width: 100%;
  }

  .main {
    padding: 4px 8px 48px;
  }

  .cell-mtime {
    display: none;
  }

  .cell-size {
    width: 84px;
  }
}

/* ── страница релиза ───────────────────────────────────────────────
 *
 * Папка версии показывается не как каталог, а как выпуск: заголовок с
 * номером и каналом, ниже файлы, под ними — «что нового» из README.md.
 */

.release-notes {
  margin: 24px 12px 8px;
}

.release-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.release-version {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.release-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.release-badge.is-release {
  background: #e6f6ec;
  border-color: #b7e3c6;
  color: #17683a;
}

.release-badge.is-rc {
  background: #fdf3e2;
  border-color: #f0d9a8;
  color: #8a5a06;
}

.release-badge.is-nightly {
  background: #eceff4;
  border-color: #d5dae2;
  color: #4a5566;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    .release-badge.is-release {
      background: #14301f;
      border-color: #1f5334;
      color: #6cd39a;
    }

    .release-badge.is-rc {
      background: #33270f;
      border-color: #5c451a;
      color: #e0b25e;
    }

    .release-badge.is-nightly {
      background: #23262b;
      border-color: #383d45;
      color: #9aa4b2;
    }
  }
}

:root[data-theme="dark"] {
    .release-badge.is-release {
      background: #14301f;
      border-color: #1f5334;
      color: #6cd39a;
    }

    .release-badge.is-rc {
      background: #33270f;
      border-color: #5c451a;
      color: #e0b25e;
    }

    .release-badge.is-nightly {
      background: #23262b;
      border-color: #383d45;
      color: #9aa4b2;
    }
}

/* текст описания: узкая колонка, читать удобнее, чем во всю ширину */
.release-body {
  max-width: 760px;
  margin-top: 20px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.release-body h2,
.release-body h3,
.release-body h4 {
  margin: 28px 0 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.release-body h2 {
  font-size: 19px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.release-body h3 {
  font-size: 16px;
}

.release-body h4 {
  font-size: 15px;
}

.release-body p {
  margin: 0 0 14px;
}

.release-body ul,
.release-body ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.release-body li {
  margin-bottom: 6px;
}

.release-body a {
  color: var(--accent);
}

.release-body a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.release-body code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.release-body pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-hover);
}

.release-body pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  line-height: 1.55;
}

.release-body blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-muted);
}

.release-body hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.release-body table {
  width: 100%;
  margin: 0 0 16px;
  border-collapse: collapse;
  font-size: 14px;
}

.release-body th,
.release-body td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.release-body th {
  background: var(--surface-hover);
  font-weight: 600;
}

/* заголовок списка файлов на странице релиза */
.release-notes:not(.hidden) ~ .paths-table thead th {
  padding-top: 26px;
}

@media (max-width: 720px) {
  .release-notes {
    margin: 16px 8px 4px;
  }

  .release-version {
    font-size: 22px;
  }
}

/* ── раскладка страницы выпуска ──────────────────────────────────────
 *
 * Широкий экран: файлы слева, описание колонкой справа, как карточка
 * релиза. Узкий: сначала файлы, ниже — «Что нового» свёрнутым блоком.
 */

.index-page.release-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* на узком экране блок релиза стоит первым и свёрнут — файлы сразу под ним */

@media (min-width: 1100px) {
  .index-page.release-layout {
    grid-template-columns: minmax(0, 1fr) 14px minmax(300px, var(--notes-w, 52%));
    gap: 0 10px;
    align-items: start;
  }

  .index-page.release-layout .release-notes {
    grid-column: 3;
    grid-row: 1 / span 4;
    position: sticky;
    top: 16px;
  }

  .index-page.release-layout .paths-table,
  .index-page.release-layout .uploaders-table,
  .index-page.release-layout .empty-folder {
    grid-column: 1;
  }

  .index-page.release-layout .release-splitter {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: stretch;
    cursor: col-resize;
    position: relative;
  }

  .index-page.release-layout .release-splitter::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 2px;
    background: var(--line-strong);
  }

  .index-page.release-layout .release-splitter:hover::before,
  .index-page.release-layout .release-splitter.dragging::before {
    background: var(--accent);
  }
}

.release-splitter { display: none; }

.release-fold {
  margin-top: 16px;
}

.release-fold > summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 16px;
  padding: 6px 0;
}

/* вложенные аккордеоны из README (сервисная часть релиза) */
.release-body details {
  margin: 14px 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.release-body details > summary {
  cursor: pointer;
  font-weight: 600;
}

.release-body details[open] > summary {
  margin-bottom: 8px;
}

.release-meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* иконки шапки наследуют цвет текста — в тёмной теме больше не чернеют */
.head svg,
.head svg path {
  fill: currentColor;
}

/* кнопка переключения темы */
.theme-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.theme-btn:hover { color: var(--text); }

/* стрелки сортировки — по центру строки, а не по базовой линии */
.paths-table th a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.paths-table th a svg {
  display: block;
  fill: currentColor;
}

/* latest: закреплена; по строке плывёт «аврора» — полупрозрачная
   волна синий→циан→фиолет поверх подложки темы. Прозрачные цвета
   работают и на белом, и на графите; при reduced motion — статично. */
.paths-table tr.latest-row {
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      rgba(51, 154, 240, 0.18) 18%,
      rgba(34, 211, 238, 0.15) 34%,
      rgba(151, 117, 250, 0.18) 52%,
      rgba(51, 154, 240, 0.15) 68%,
      transparent 100%
    ),
    var(--surface-hover);
  background-size: 300% 100%, auto;
  background-position: 0% 0, 0 0;
  animation: latest-aurora 9s ease-in-out infinite alternate;
}

@keyframes latest-aurora {
  from { background-position: 0% 0, 0 0; }
  to   { background-position: 100% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .paths-table tr.latest-row {
    animation: none;
    background-position: 50% 0, 0 0;
  }
}

.paths-table tr.latest-row .cell-name a {
  font-weight: 700;
}

/* все строки и шрифт чуть крупнее (по макету: имена 15px, мета 14px) */
.paths-table {
  --row-height: 62px;
}

.paths-table .cell-name a {
  font-size: 15px;
}

.paths-table .cell-mtime,
.paths-table .cell-size {
  font-size: 14px;
}
}

/* вся строка кликабельна */
.paths-table tbody tr {
  cursor: pointer;
}
