/* Работа в Сергели — Mini App
   Эстетика: производственная сигналетика. Узкий гротеск заглавными, чёрный
   асфальт, сигнальная жёлтая лента, острые углы. Никаких скруглений и мягких
   теней: аудитория — стройка, цеха и доставка, а не финтех-лендинг. */

:root {
  --amber: #ffb300;
  /* Тёмный янтарь для текста на светлом фоне. #e08600 читался бы «фирменнее»,
     но даёт контраст 2.7 — зарплату не разобрать на солнце. Здесь 4.8 (AA). */
  --amber-deep: #a85f00;
  --ink: #0d0d0f;
  --ink-soft: #17171b;
  --ink-line: #2a2a31;
  --paper: #f4f1ea;
  --paper-dim: #cfcabd;
  --text: #f4f1ea;
  --text-dim: #9a978f;
  --danger: #ff5c40;
  --tape-a: #ffb300;
  --tape-b: #0d0d0f;

  --bg: var(--ink);
  --surface: var(--ink-soft);
  --line: var(--ink-line);

  --pad: 16px;
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
}

/* Светлая тема Telegram — инвертируем на «бумагу и типографскую краску»,
   но сигнальный жёлтый остаётся тем же: это опознавательный знак приложения. */
body.theme-light {
  --bg: var(--paper);
  --surface: #fffdf8;
  --line: #ddd8cb;
  --text: var(--ink);
  --text-dim: #6b675e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

/* Зерно поверх фона — даёт «печатную» фактуру вместо стерильной заливки. */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Шапка --- */

.masthead {
  padding: 22px var(--pad) 14px;
  animation: rise 0.5s ease-out both;
}

.masthead__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.masthead__title {
  font-family: var(--font-display);
  font-size: clamp(38px, 13vw, 58px);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* Счётчик вакансий — как штамп на наряде. */
.masthead__badge {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  background: var(--amber);
  color: var(--ink);
  padding: 3px 9px 2px;
  transform: rotate(-3deg);
  white-space: nowrap;
}

.masthead__sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* --- Сигнальная лента: опознавательный элемент интерфейса --- */

.tape {
  height: 10px;
  background: repeating-linear-gradient(
    45deg,
    var(--tape-a) 0 12px,
    var(--tape-b) 12px 24px
  );
}

.tape--thin { height: 6px; }

/* --- Фильтры --- */

.filters {
  display: flex;
  gap: 8px;
  padding: 14px var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  animation: rise 0.5s 0.05s ease-out both;
}

.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  background: transparent;
  border: 1.5px solid var(--line);
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  /* Крупная зона нажатия: приложением пользуются на ходу, часто в перчатках. */
  min-height: 40px;
}

.chip:active { transform: translateY(1px); }

.chip[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

.chip__count {
  opacity: 0.55;
  margin-left: 5px;
  font-size: 11px;
}

/* --- Лента вакансий --- */

.feed {
  padding: 4px var(--pad) 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  /* Жёлтая полоса слева — маркер «наряда», связывает карточку с лентой. */
  border-left: 5px solid var(--amber);
  padding: 14px 14px 12px;
  animation: rise 0.4s ease-out both;
}

/* Лесенка появления: карточки въезжают по очереди, а не разом. */
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(n + 6) { animation-delay: 0.22s; }

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.card__date {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 3px;
}

.card__salary {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--amber);
  margin: 8px 0 2px;
  letter-spacing: 0.01em;
}

body.theme-light .card__salary { color: var(--amber-deep); }

.card__text {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 14px;
  white-space: pre-line;
  /* Длинные посты из каналов сворачиваем — иначе одна вакансия займёт экран. */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card.is-open .card__text {
  -webkit-line-clamp: unset;
  display: block;
}

.card__more {
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  padding: 3px 7px;
  color: var(--text-dim);
}

.tag--source { border-style: dashed; }

.card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* --- Кнопки --- */

.btn {
  flex: 1;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 14px;
  min-height: 46px;
  border: 1.5px solid var(--amber);
  background: var(--amber);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active { transform: translateY(1px); filter: brightness(0.92); }

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

.btn--wide { width: 100%; }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* --- Пустая лента и ошибки --- */

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.empty__mark {
  font-family: var(--font-display);
  font-size: 64px;
  line-height: 1;
  color: var(--amber);
  opacity: 0.4;
}

.empty__title {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  color: var(--text);
  margin: 12px 0 6px;
}

/* --- Скелетон загрузки --- */

.skeleton {
  height: 116px;
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 25%, var(--line) 50%, var(--surface) 75%);
  background-size: 300% 100%;
  animation: sweep 1.4s ease-in-out infinite;
}

/* --- Шторка с контактом --- */

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet[hidden] { display: none; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  animation: fade 0.2s ease-out both;
}

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1.5px solid var(--line);
  animation: slide-up 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet__body { padding: 18px var(--pad) 20px; }

.sheet__title {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  font-weight: 600;
}

.sheet__hint {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

.sheet__contact {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg);
  border: 1.5px dashed var(--amber);
  text-align: center;
  user-select: all;
  word-break: break-all;
}

.sheet__actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

/* --- Подвал --- */

.footer {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.footer p { padding: 14px var(--pad) 24px; }

/* --- Анимации --- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes sweep {
  from { background-position: 150% 0; }
  to { background-position: -150% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
