/* ═════════════════════════════════════════════════════════════════════
   Окно SXfont, нарисованное кодом: блок «Светлая и тёмная тема»
   и блок «Обложки». Свёрстано в «проектных» пикселях 1400×748
   и масштабируется целиком (--k ставит assets/js/app-window.js
   по ширине места).
   Цвета — из кода приложения: Theme.swift, DesignSystem.swift,
   NativeCardItem.swift, Sidebar*.swift. Тёмная тема — те же элементы,
   другие значения переменных (.thw--dark).
   Скругления вложены: окно 34 = карточка/панель 18 + отступ 16;
   панель 18 = кнопки 9 + отступ 9; подложка видов 9 = сегмент 7 + 2.
   ═════════════════════════════════════════════════════════════════════ */

.thw {
  --t-bg: #FBFBFB;
  --t-side: #F7F7F7;
  --t-sep: rgba(0,0,0,.08);
  --t-text: #262626;
  --t-icon: #595959;
  --t-sec: #9A9A9E;
  --t-ter: #BDBDC1;
  --t-sel: #fff;
  --t-sel-sh: 0 0 0 .5px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.05);
  --t-bar: #fff;
  --t-bar-ring: #EDEDED;
  --t-ctl: #F5F5F5;
  --t-seg: #fff;
  --t-seg-sh: 0 1px 1px rgba(0,0,0,.05);
  --t-seg-icon: #2F2F2F;
  --t-icon2: #878787;
  --t-ph: #898989;
  --t-btn: #2F2F2F;
  --t-track: #E3E3E6;
  --t-knob: #fff;
  --t-div: #ECECEC;
  --t-card: #fff;
  --t-card-ring: #EFEFEF;
  --t-pv: #272727;
  --t-meta: #6E6E6E;

  position: absolute; left: 0; top: 0;
  width: 1400px; height: 748px;
  transform: scale(var(--k, .8571)); transform-origin: 0 0;
  border-radius: 34px;
  overflow: hidden;
  background: var(--t-bg);
  box-shadow: var(--shadow-win);
  font-family: var(--mac); font-size: 13px; color: var(--t-text);
  text-align: left;
}
/* тёмная тема: у окна macOS светлая кромка сверху и едва заметная по бокам */
.thw--dark {
  --t-bg: #1C1C1E;
  --t-side: #1E1E20;
  --t-sep: rgba(255,255,255,.12);
  --t-text: #E7E6E9;
  --t-icon: #98989F;
  --t-sec: #A7A6A9;
  --t-ter: #656567;
  --t-sel: rgba(255,255,255,.12);
  --t-sel-sh: none;
  --t-bar: #1E1E1E;
  --t-bar-ring: rgba(255,255,255,.11);
  --t-ctl: #3A3A3C;
  --t-seg: #1E1E1E;
  --t-seg-sh: none;
  --t-seg-icon: #E5E5E5;
  --t-icon2: #B4B4B4;
  --t-ph: #B2B2B2;
  --t-btn: #E5E5E5;
  --t-track: #3C3C3C;
  --t-knob: #E3E3E3;
  --t-div: #2A2A2A;
  --t-card: #232325;
  --t-card-ring: rgba(255,255,255,.12);
  --t-pv: #E5E5E7;
  --t-meta: #98989F;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), inset 0 1px 0 rgba(255,255,255,.22);
}
.thw .ic { display: block; flex: none; width: 16px; height: 16px; }

/* ─── боковая панель ─── */
.thw__side {
  position: absolute; left: 0; top: 0; bottom: 0; width: 240px;
  padding: 14px 8px;
  background: var(--t-side);
  border-right: 1px solid var(--t-sep);
}
/* центр первого кружка в 26 px от краёв: от дуги угла до кружка столько же воздуха, сколько до края */
.thw__lights { display: flex; gap: 8px; padding: 6px 12px 0; }
.thw__lights i { width: 12px; height: 12px; border-radius: 50%; background: #FF5F57; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.12); }
.thw__lights i:nth-child(2) { background: #FEBC2E; }
.thw__lights i:nth-child(3) { background: #28C840; }
/* кнопка скрытия панели — на одной линии с серединой панели инструментов (58) */
.thw__sidetop { display: flex; justify-content: flex-end; align-items: center; height: 28px; margin-top: 12px; padding-right: 6px; color: var(--t-sec); }
.thw__sidetop .ic { width: 18px; height: 16px; }
.thw__list { margin-top: 16px; display: grid; gap: 1px; }
.thw__list--sep { padding-top: 16px; border-top: 1px solid var(--t-sep); }
.thw__label { margin: 18px 0 6px 19px; font-size: 11px; font-weight: 600; color: var(--t-sec); }
.thw__label + .thw__list { margin-top: 0; }
.thw__row {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 28px; padding: 0 12px 0 19px; border-radius: 6px;
  white-space: nowrap; color: var(--t-text);
}
.thw__row > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.thw__row .ic { color: var(--t-icon); }
.thw__row img { width: 16px; height: 16px; flex: none; }
.thw__row b { font-weight: 400; font-size: 10.5px; color: var(--t-sec); font-variant-numeric: tabular-nums; }
.thw__row.is-on { background: var(--t-sel); box-shadow: var(--t-sel-sh); }
.thw__row--tag i { width: 16px; flex: none; text-align: center; font-style: normal; font-family: var(--mono); font-size: 14px; color: var(--t-ter); }
/* у папок с подпапками слева стрелка «›» */
.thw__row--kids::before {
  content: ""; position: absolute; left: 6px; top: 50%;
  width: 5px; height: 5px; margin-top: -3px;
  border-right: 1.4px solid var(--t-ter); border-bottom: 1.4px solid var(--t-ter);
  transform: rotate(-45deg);
}

/* ─── панель инструментов ─── */
.thw__bar {
  position: absolute; left: 256px; top: 32px; width: 1128px; height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 9px;
  border-radius: 18px;
  background: var(--t-bar);
  box-shadow: 0 0 0 1px var(--t-bar-ring);
}
.thw__size { display: flex; align-items: center; gap: 8px; padding: 0 8px; color: var(--t-sec); font-family: var(--mono); font-size: 11px; }
.thw__size .big { font-size: 14px; }
.thw__track { position: relative; width: 104px; height: 6px; border-radius: 3px; background: var(--t-track); }
.thw__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 38%; border-radius: 3px; background: #007AFF; }
.thw__knob { position: absolute; top: 50%; left: 38%; width: 20px; height: 14px; margin: -7px 0 0 -10px; border-radius: 7px; background: var(--t-knob); box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.25); }
.thw__views { position: relative; display: flex; gap: 1px; margin-right: 11px; padding: 2px; border-radius: 9px; background: var(--t-ctl); }
.thw__views::after { content: ""; position: absolute; right: -11px; top: 5px; bottom: 5px; width: 1px; background: var(--t-div); }
.thw__views span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--t-icon2); }
.thw__views span.is-on { background: var(--t-seg); color: var(--t-seg-icon); box-shadow: var(--t-seg-sh); }
.thw__views .ic { width: 15px; height: 15px; }
.thw__field {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px; border-radius: 9px;
  background: var(--t-ctl); color: var(--t-ph);
  font-size: 14px; white-space: nowrap;
}
.thw__field .ic { color: var(--t-icon2); }
.thw__field .thw__chev { width: 9px; height: 9px; margin-left: -6px; }
.thw__field--search { flex: none; width: 190px; }
.thw__field--search .ic { width: 14px; height: 14px; color: var(--t-ter); }
.thw__btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--t-ctl); color: var(--t-btn);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.thw__btn .ic { width: 15px; height: 15px; }
.thw__panel { position: relative; display: grid; place-items: center; width: 30px; height: 30px; margin-left: 11px; color: var(--t-sec); }
.thw__panel::before { content: ""; position: absolute; left: -11px; top: 3px; bottom: 3px; width: 1px; background: var(--t-div); }
.thw__panel .ic { width: 18px; height: 16px; transform: scaleX(-1); }

/* ─── карточки: 4 × 3, нижний ряд в 16 px от края окна ─── */
.thw__grid {
  position: absolute; left: 256px; top: 100px; width: 1128px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.thw__card {
  position: relative; height: 200px;
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: var(--t-card);
  box-shadow: 0 0 0 1px var(--t-card-ring);
}
/* превью в одну строку, как в приложении; длинные app-window.js уменьшает по ширине */
.thw__pv {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 20px 6px;
  color: var(--t-pv); font-size: 36px; line-height: 1.15;
}
.thw__pv span { max-width: 100%; overflow: hidden; white-space: nowrap; }
.thw__meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 44px; padding: 0 18px;
  border-top: 1px solid var(--t-card-ring);
  font-size: 11px; color: var(--t-meta); white-space: nowrap;
}
.thw__meta span + span { font-family: var(--mono); font-size: 11.5px; }
/* в избранном и включена: значки видны всегда, у остальных — только под курсором */
.thw__fav, .thw__bolt { position: absolute; top: 14px; width: 16px; height: 16px; }
.thw__fav { left: 18px; color: #FF4458; }
.thw__fav .ic { width: 15px; height: 14px; margin-top: 1px; }
.thw__bolt { right: 18px; color: var(--bolt-on); }
.thw__bolt .ic { width: 12px; height: 16px; margin-left: 2px; }

/* набранный текст превью в поле (в блоке «Обложки») */
.thw__field .thw__typed { color: var(--t-text); }

/* ─── «Обложки»: два вида в одном окне, их переключают кнопки над блоком (site.js) ─── */
.thw__grid[data-view] { transform-origin: 50% 0; transition: opacity .5s var(--ease), transform .7s var(--ease); }
.thw__grid[data-view]:not(.is-on) { opacity: 0; transform: scale(.985); }
/* третий ряд обложек уходит под край окна и тает: срезанных углов не видно */
.thw__covers {
  /* ряды по содержимому: иначе сетка сжала бы их под высоту окна и срезала подписи */
  height: 648px; align-content: start; grid-auto-rows: max-content; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 76%, transparent 99%);
  mask-image: linear-gradient(#000 76%, transparent 99%);
}
.thw__cover {
  position: relative; overflow: hidden;
  border-radius: 18px;
  background: var(--t-card);
  box-shadow: 0 0 0 1px var(--t-card-ring);
}
.thw__cover img { display: block; width: 100%; aspect-ratio: 373 / 268; object-fit: cover; }
.thw__cmeta { position: relative; height: 48px; padding: 9px 60px 0 16px; }
.thw__cmeta b { display: block; font-size: 12px; font-weight: 500; color: var(--t-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thw__cmeta span { display: block; margin-top: 3px; font-family: var(--mono); font-size: 10.5px; color: var(--t-meta); }
.thw__cmeta .thw__cicons { position: absolute; right: 16px; top: 16px; display: flex; align-items: center; gap: 10px; margin: 0; }
.thw__cicons .ic { width: 14px; height: 13px; }
.thw__cicons .is-fav { color: #FF4458; }
.thw__cicons .is-bolt { width: 11px; height: 15px; color: var(--bolt-on); }
