/* jajob.dk design tokens + component classes. Джерело правди — design/DESIGN.md. */
:root {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --fg: #0f172a;
  --fg-muted: #5b6678; /* було #64748b: 4.3:1 на бейджах/тонованих фонах < WCAG AA (launch-QA) */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-fg: #ffffff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .05);

  --ease: cubic-bezier(.2, .8, .2, 1);
}

html { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif; }
body { background: var(--bg); color: var(--fg); }

/* ---- Button ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  font-weight: 500; font-size: 14px; line-height: 1; cursor: pointer;
  border: 1px solid transparent; transition: background .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-fg); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--shadow-sm); }
.btn-ghost { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: transparent; color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---- Card ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); padding: 24px;
}
.card-hover { transition: box-shadow .15s var(--ease), transform .15s var(--ease); }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ---- Form controls ---- */
.input {
  width: 100%; background: var(--surface); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 16px; line-height: 1.4;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--fg-muted); }
.input:focus, .input:focus-visible {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
/* Голий клас `border` (Tailwind preflight → #e5e7eb) не знав про тему: у темній — білі рамки
   карток (pipeline, логін, форми). Колір рамки за замовчуванням — токен (launch-QA). */
*, ::before, ::after { border-color: var(--border); }
.label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.field-error { color: var(--danger); font-size: 14px; margin-top: 4px; }

/* Facet selects: native chevron room so option text never clips (mobile bug fix) */
select.input, select.select-facet {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  text-overflow: ellipsis;
  /* Вертикальний padding 0 + фіксована висота: інакше компактні select із inline height:30-32px
     (pipeline, команда, збережені пошуки) обрізали текст знизу (launch-QA 18.10.2026). */
  height: 40px; padding-top: 0; padding-bottom: 0;
}
.select-facet { height: 40px; font-size: 14px; }

/* ---- Badge / status ---- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 9999px; font-size: 12px; font-weight: 500;
  background: #f1f5f9; color: var(--fg-muted);
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-match { background: #eef2ff; color: var(--brand); font-weight: 600; }
/* Founding employer (холодний старт): бейдж + банер. Тінт від --brand → темна тема автоматично. */
.badge-founding {
  gap: 4px; font-weight: 600; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}
.promo-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-radius: var(--radius-xl); text-align: left;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}
/* Текст займає рядок, поки є ≥260px; інакше дія (кнопка/форма) переноситься під нього. */
.promo-banner > :first-child { flex: 1 1 260px; min-width: 0; }
.promo-banner .input { min-width: 9rem; }
.promo-note {
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  line-height: 1.4; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}
.promo-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand);
}
.promo-meter {
  height: 6px; border-radius: 9999px; overflow: hidden;
  background: color-mix(in srgb, var(--brand) 15%, var(--surface));
}
.promo-meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

/* ---- Curated category chips (Otta-патерн) ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 9999px; font-size: 13px; font-weight: 500;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border);
  text-decoration: none; transition: background .12s var(--ease), border-color .12s var(--ease);
}
.chip:hover { background: var(--bg-subtle); }
.chip-active { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.chip-count { font-size: 11px; opacity: .75; }

/* ---- Sidebar nav ---- */
.nav-item {
  display: block; padding: 8px 12px; border-radius: var(--radius);
  font-size: 14px; color: var(--fg-muted); text-decoration: none;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: #f1f5f9; color: var(--fg); }
.nav-item-active { background: #eef2ff; color: var(--brand); font-weight: 600; }

/* ---- Mobile bottom-nav (seeker) — self-contained (no Tailwind dependency) ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 11px; color: var(--fg-muted); text-decoration: none;
}
.bottom-tab-active { color: var(--brand); font-weight: 600; }
.bottom-tab:active { background: #f1f5f9; }

/* ---- Sticky mobile apply-bar ---- */
.apply-bar {
  position: fixed; left: 0; right: 0; bottom: 56px; z-index: 39;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 16px; padding-bottom: 10px;
  display: flex; gap: 8px; align-items: center; box-shadow: 0 -2px 8px rgba(15,23,42,.06);
}
.apply-bar .btn-primary { flex: 1; }
/* Контент не ховається за фіксованою панеллю (незалежно від Tailwind) */
@media (max-width: 639px) {
  body:has(.bottom-nav) main { padding-bottom: 84px; }
  body:has(.apply-bar) main { padding-bottom: 148px; }
}
/* На ≥640px ховаємо мобільні панелі */
@media (min-width: 640px) {
  .bottom-nav, .apply-bar { display: none; }
}


/* ---- Dark mode: system-default + явний перемикач [data-theme] ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --bg-subtle: #1a2438;
    --surface: #131c2e;
    --border: #26334a;
    --fg: #e8eefb;
    --fg-muted: #94a3b8;
    --brand: #818cf8;
    --brand-hover: #a5b4fc;
    --brand-fg: #0b1120;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .25);
    --shadow: 0 4px 12px rgba(0, 0, 0, .45), 0 2px 4px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-subtle: #1a2438;
  --surface: #131c2e;
  --border: #26334a;
  --fg: #e8eefb;
  --fg-muted: #94a3b8;
  --brand: #818cf8;
  --brand-hover: #a5b4fc;
  --brand-fg: #0b1120;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .25);
  --shadow: 0 4px 12px rgba(0, 0, 0, .45), 0 2px 4px rgba(0, 0, 0, .3);
}

/* Хардкод-кольори, що мали hover/фон під світлу тему → токенізовані */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-ghost:hover,
  :root:not([data-theme="light"]) .nav-item:hover,
  :root:not([data-theme="light"]) .bottom-tab:active { background: #1c2740; }
  :root:not([data-theme="light"]) .nav-item-active,
  :root:not([data-theme="light"]) .badge-match { background: #1e2a4d; }
  :root:not([data-theme="light"]) .badge { background: #1c2740; }
  :root:not([data-theme="light"]) .badge-success { background: #14352a; color: #6ee7a8; }
  :root:not([data-theme="light"]) .badge-warning { background: #3a2c12; color: #fbbf24; }
  :root:not([data-theme="light"]) .badge-danger { background: #3b1a1c; color: #fca5a5; }
  :root:not([data-theme="light"]) .skeleton {
    background: linear-gradient(90deg, #1a2438 25%, #24304a 37%, #1a2438 63%);
    background-size: 400% 100%;
  }
}
:root[data-theme="dark"] .btn-ghost:hover,
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .bottom-tab:active { background: #1c2740; }
:root[data-theme="dark"] .nav-item-active,
:root[data-theme="dark"] .badge-match { background: #1e2a4d; }
:root[data-theme="dark"] .badge { background: #1c2740; }
:root[data-theme="dark"] .badge-success { background: #14352a; color: #6ee7a8; }
:root[data-theme="dark"] .badge-warning { background: #3a2c12; color: #fbbf24; }
:root[data-theme="dark"] .badge-danger { background: #3b1a1c; color: #fca5a5; }
:root[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1a2438 25%, #24304a 37%, #1a2438 63%);
  background-size: 400% 100%;
}

/* Тема-перемикач */
.theme-toggle {
  background: none; border: 0; cursor: pointer; font-size: 15px; line-height: 1;
  padding: 4px 6px; border-radius: var(--radius-sm); color: var(--fg-muted);
}
.theme-toggle:hover { color: var(--fg); }

/* Перемикач мов: на мобільному — компактне меню (EN · DA · UK + довгі uk-підписи не влазять у 375px) */
.lang-menu { display: none; position: relative; }
.lang-menu > summary {
  list-style: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--fg);
  padding: 4px 6px; border-radius: var(--radius-sm); white-space: nowrap;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary::after { content: " ▾"; color: var(--fg-muted); font-weight: 400; }
.lang-menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 140px;
  display: flex; flex-direction: column; padding: 4px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}
.lang-menu-pop a { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--fg); }
.lang-menu-pop a:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.lang-menu-pop a[aria-current] { font-weight: 600; color: var(--brand); }
@media (max-width: 639px) {
  .lang-inline { display: none !important; }
  .lang-menu { display: block; }
  /* Картка вакансії: зарплата під заголовком, а не стовпчиком поруч (довгі uk/da підписи «на місяць») */
  .job-head { flex-direction: column; gap: 4px; }
  /* Шапка 375px: uk/da підписи довші за en — щільніші відступи замість переповнення */
  header nav > a { padding-left: 4px !important; padding-right: 4px !important; white-space: nowrap; }
  header nav .btn-sm { padding-left: 10px; padding-right: 10px; white-space: nowrap; }
}

/* ---- Focus-visible (a11y) ---- */
a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

/* ---- Motion: scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---- Skeleton shimmer ---- */
.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Hero subtle gradient ---- */
.hero-glow {
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(79, 70, 229, .10), transparent 70%),
    radial-gradient(40% 40% at 80% 10%, rgba(22, 163, 74, .06), transparent 70%);
}

/* ---- prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Юридичні сторінки: markdown-таблиці прокручуються всередині, сторінка — ні (375px). */
.legal table { display: block; overflow-x: auto; width: 100%; margin-top: 1rem; border-collapse: collapse; font-size: .875rem; }
.legal th, .legal td { border: 1px solid var(--border); padding: .5rem .625rem; text-align: left; vertical-align: top; min-width: 8rem; }
.legal th { background: var(--surface-2, var(--bg)); font-weight: 600; }

/* DPA: версія для підпису — друк/PDF без навігації сайту. */
.legal table.dpa-sign td { height: 2.5rem; }
@media print {
  header, footer, .bottom-nav, .no-print, [role="note"] { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0 !important; }
  article { border: 0 !important; box-shadow: none !important; padding: 0 !important; max-width: none !important; }
  .legal table { display: table; overflow: visible; }
}

/* ---- Автентифікація й антибот (M60) ---- */
/* Honeypot: поза екраном, не display:none (частина ботів пропускає приховані поля). */
.jj-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.notice-ok {
  padding: 10px 12px; border-radius: var(--radius); font-size: 14px; line-height: 1.45;
  border: 1px solid color-mix(in srgb, var(--success) 40%, var(--border));
  background: color-mix(in srgb, var(--success) 8%, var(--surface));
}
.notice-warn {
  padding: 10px 12px; border-radius: var(--radius); font-size: 14px; line-height: 1.45;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}
.otp-input { font-size: 24px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qr-box { align-self: flex-start; display: inline-block; padding: 8px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); line-height: 0; }
.qr-box svg { width: 200px; height: 200px; }
.secret-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; word-break: break-all; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg-subtle); }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
form.ab-waiting button[aria-busy="true"] { opacity: .7; cursor: progress; }
