/* Israel Funding Tracker - "Funding Wire" (D1)
   Cool paper, ink-blue accent, IBM Plex Sans for headlines and money, Inter for everything else. */

:root {
  --paper: #f4f5f7;
  --surface: #ffffff;
  --hover: #eceef3;
  --ink: #15171c;
  --ink-2: #4a505b;
  --ink-3: #767c88;
  --rule: #dfe2e8;
  --accent: #2440b3;
  --accent-ink: #ffffff;
  --accent-soft: #e6eafa;
  --warn: #8a5a00;
  --warn-soft: #f9efd9;
  --shadow: 0 24px 60px -20px rgba(20, 28, 60, 0.28);

  --display: "IBM Plex Sans", "IBM Plex Sans Hebrew", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Inter", "Assistant", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --toolbar-h: 0px; /* set by app.js */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101217;
    --surface: #171a21;
    --hover: #1c2029;
    --ink: #eceef2;
    --ink-2: #b2b7c1;
    --ink-3: #868c97;
    --rule: #262a33;
    --accent: #9fb2ff;
    --accent-ink: #0f1430;
    --accent-soft: #1d2444;
    --warn: #e8b85f;
    --warn-soft: #2c2412;
    --shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #101217;
  --surface: #171a21;
  --hover: #1c2029;
  --ink: #eceef2;
  --ink-2: #b2b7c1;
  --ink-3: #868c97;
  --rule: #262a33;
  --accent: #9fb2ff;
  --accent-ink: #0f1430;
  --accent-soft: #1d2444;
  --warn: #e8b85f;
  --warn-soft: #2c2412;
  --shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
body.locked { overflow: hidden; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.num { text-align: end; }

/* Masthead ------------------------------------------------------------ */

.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 22px; padding-bottom: 22px;
}
.wordmark {
  font: 600 17px/1 var(--display);
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
}
.wordmark::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.masthead-end { display: flex; align-items: center; gap: 14px; }
.updated { color: var(--ink-3); font-size: 13px; white-space: nowrap; }

.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%; background: transparent; cursor: pointer;
  color: var(--ink-2); transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Language button: Israeli flag + "עברית" in English, "English" in Hebrew. */
.lang-toggle {
  height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule); border-radius: 999px; background: transparent; cursor: pointer;
  color: var(--ink-2); font: 500 13px/1 var(--sans); white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.lang-toggle:hover { background: var(--hover); color: var(--ink); }
.lang-toggle .flag { width: 22px; height: 16px; flex: none; display: block; }
.lang-toggle .lang-short { display: none; }
:root[lang="he"] .lang-toggle .flag { display: none; }

/* Hebrew: no tight letter-spacing (it is tuned for the Latin fonts). */
:root[lang="he"] .hero h1 { letter-spacing: 0; line-height: 1.12; max-width: 30ch; font-size: clamp(30px, 4.8vw, 56px); }
:root[lang="he"] .wordmark,
:root[lang="he"] .group-title { letter-spacing: 0; }
[dir="rtl"] .sort select { background-position: left 9px center; }
/* English company name and city in the Hebrew details panel: keep them on the right with the Hebrew around them. */
[dir="rtl"] .d-title, [dir="rtl"] .d-hq { text-align: right; }
[dir="rtl"] .d-title { padding-right: 0; padding-left: 40px; }

/* Hero ---------------------------------------------------------------- */

.hero { padding-top: clamp(28px, 7vw, 72px); padding-bottom: clamp(28px, 5vw, 48px); }

.hero h1 {
  margin: 0;
  max-width: 27ch;
  font: 500 clamp(34px, 5.2vw, 62px)/1.08 var(--display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.summary {
  margin: clamp(20px, 3vw, 28px) 0 0;
  max-width: 34em;
  font: 400 clamp(18px, 2.1vw, 22px)/1.45 var(--display);
  color: var(--ink-2);
  min-height: 2.9em;
}
.summary .fig {
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
  padding: 0 0.08em;
}

/* Toolbar (sticky) ---------------------------------------------------- */

.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.toolbar-inner { padding-top: 12px; padding-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.toolbar-row { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.toolbar-end { display: flex; align-items: center; gap: 14px; }

.search { position: relative; display: block; }
.search svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0; padding-inline: 42px 14px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--surface); color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule); border-radius: 999px; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip .count { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] .count { color: inherit; opacity: 0.65; }

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px; background: var(--rule); position: relative;
  transition: background-color 0.2s ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
[dir="rtl"] .switch input:checked + .switch-track::after { transform: translateX(-14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.sort select {
  height: 32px; padding: 0; padding-inline: 12px 30px; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767c88' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; appearance: none;
}

/* List ---------------------------------------------------------------- */

.list-section { padding-top: 8px; padding-bottom: 56px; min-height: 40vh; }

.list-head,
.row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 118px 128px 96px 116px;
  column-gap: 20px;
  align-items: center;
}
.list-head {
  padding: 14px 14px 10px; color: var(--ink-3); font-size: 12px; font-weight: 500;
}

.group-title {
  position: sticky; top: var(--toolbar-h); z-index: 5;
  display: flex; align-items: baseline; gap: 10px;
  margin: 0; padding: 22px 14px 10px;
  background: var(--paper);
  font: 500 19px/1.2 var(--display);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.25s ease;
}
.group-title small { font: 400 13px/1 var(--sans); color: var(--ink-3); }

.row {
  position: relative;
  padding: 16px 14px;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  transition: background-color 0.18s ease;
}
.row:hover { background: var(--hover); }
.row:hover .row-name { color: var(--accent); }

.row-date { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.row-main { min-width: 0; }
.row-open {
  all: unset; cursor: pointer;
  display: inline; font-weight: 600; font-size: 16px; letter-spacing: -0.005em;
}
.row-open::after { content: ""; position: absolute; inset: 0; } /* whole row opens details */
.row-open:focus-visible { outline: none; }
.row:has(.row-open:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.row-name { transition: color 0.18s ease; }
.row-desc {
  margin: 3px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.row-hq { color: var(--ink-3); font-size: 13px; font-weight: 400; margin-inline-start: 8px; }
.row-desc.is-short { display: block; -webkit-line-clamp: unset; overflow: visible; } /* max 80 characters: never cut */
.row-facts { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.fact-label { color: var(--ink-3); }
.fact-link { position: relative; z-index: 1; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.fact-link:hover { text-decoration: underline; }
.row-facts .ok { color: var(--accent); }
.row-facts .warn { color: #a15c00; }
.fact-category, .fact-category .fact-label { font-weight: 700; color: var(--ink); }

.stage {
  justify-self: start;
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 6px; background: var(--hover); color: var(--ink-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.row:hover .stage { background: var(--surface); }
.stage.is-vague { background: transparent; color: var(--ink-3); padding: 0; }

.amount {
  text-align: end;
  font: 500 21px/1.1 var(--display);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.amount.unknown { color: var(--ink-3); font: 400 13px/1.2 var(--sans); }
.amount .flag { display: block; margin-top: 4px; font: 500 11px/1 var(--sans); color: var(--warn); letter-spacing: 0; }

.careers { position: relative; z-index: 1; justify-self: end; }
.btn-careers {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 13px;
  border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.btn-careers:hover { background: var(--accent); color: var(--accent-ink); }
.btn-careers:active { transform: scale(0.97); }
.no-careers { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.jobs { text-align: end; font: 500 21px/1.1 var(--display); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.jobs.none { color: var(--ink-3); font: 400 13px/1.2 var(--sans); }
.jobs-count { display: block; margin-top: 4px; color: var(--ink-3); font-size: 12px; text-align: end; white-space: nowrap; }
.d-jobs { margin: 10px 0 0; color: var(--ink-2); font-size: 13px; }

/* Loading, empty and error states -------------------------------------- */

.skeleton {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--hover) 0%, var(--rule) 50%, var(--hover) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton-line { width: min(100%, 28em); height: 1.1em; margin-top: 0.3em; }
.skeleton-row { height: 58px; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.state { padding: 64px 14px; text-align: center; color: var(--ink-2); }
.state h2 { margin: 0 0 6px; font: 500 22px/1.3 var(--display); color: var(--ink); }
.state p { margin: 0 auto 18px; max-width: 32em; }
.btn {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.btn:hover { border-color: var(--ink-3); }

/* Details drawer ------------------------------------------------------ */

.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(12, 14, 22, 0.42);
  opacity: 0; transition: opacity 0.26s ease;
}
.scrim.open { opacity: 1; }

.drawer {
  position: fixed; z-index: 50; top: 0; inset-inline-end: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--surface); box-shadow: var(--shadow);
  transform: translateX(104%); transition: transform 0.32s var(--ease);
  display: flex; flex-direction: column;
}
[dir="rtl"] .drawer:not(.open) { transform: translateX(-104%); }
.drawer.open { transform: none; }
.drawer-grip { display: none; }
.drawer-close {
  position: absolute; top: 16px; inset-inline-end: 16px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.drawer-close:hover { background: var(--hover); color: var(--ink); }
.drawer-body { overflow-y: auto; padding: 28px 28px 36px; overscroll-behavior: contain; }

.d-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; padding-inline-end: 48px; }
.d-title {
  margin: 14px 0 0; padding-inline-end: 40px;
  font: 500 34px/1.08 var(--display); letter-spacing: -0.02em;
}
.d-hq { margin: 6px 0 0; color: var(--ink-3); font-size: 14px; }
.d-domain { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.d-money { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 24px 0; border-radius: 12px; overflow: hidden; background: var(--rule); border: 1px solid var(--rule); }
.d-money div { background: var(--surface); padding: 14px 16px; }
.d-money dt { font-size: 12px; color: var(--ink-3); }
.d-money dd { margin: 4px 0 0; font: 500 26px/1.1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.d-money dd.unknown { font: 400 14px/1.6 var(--sans); color: var(--ink-3); }

.d-desc { margin: 0; font: 400 16px/1.6 var(--display); color: var(--ink); }

.d-review {
  margin: 20px 0 0; padding: 12px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.5;
}

.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }
.d-actions .btn-careers { height: 40px; padding: 0 18px; font-size: 14px; background: var(--accent); color: var(--accent-ink); }
.d-actions .btn-careers:hover { filter: brightness(1.08); }
.link-pill {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 500; transition: border-color 0.18s ease, background-color 0.18s ease;
}
.link-pill:hover { border-color: var(--ink-3); background: var(--hover); }

.d-section-title { margin: 32px 0 10px; font: 500 16px/1.3 var(--display); }
.d-sources { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.d-sources li { border-bottom: 1px solid var(--rule); }
.d-sources a {
  display: block; padding: 10px 0; color: var(--ink-2); text-decoration: none; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.d-sources a:hover { color: var(--accent); }
.d-sources a strong { color: var(--ink); font-weight: 600; margin-inline-end: 6px; }
.d-sources-more { margin: 10px 0 0; color: var(--ink-3); font-size: 13px; }

/* Footer -------------------------------------------------------------- */

.footer { padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 13px; }
.footer p { max-width: 60em; margin: 0; }
.footer a { color: var(--ink-2); }
.credits { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }
.credits span { display: inline-flex; align-items: center; gap: 5px; }
.credits svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.credits a { text-decoration: underline; text-underline-offset: 2px; }
.credits a:hover { color: var(--ink); }

/* Phone --------------------------------------------------------------- */

@media (max-width: 760px) {
  body { font-size: 15px; }
  /* Phone: the language button shrinks to the flag (English) or "EN" (Hebrew). */
  .lang-toggle { padding: 0 9px; }
  .lang-toggle .lang-long { display: none; }
  :root[lang="he"] .lang-toggle .lang-short { display: inline; }
  /* Phone header: "Updated" sits on a small line under the site name; the two buttons stay on the side. */
  .masthead {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "mark lang theme" "upd lang theme";
    column-gap: 8px; row-gap: 5px; align-items: center;
  }
  .masthead-end { display: contents; }
  .wordmark { grid-area: mark; font-size: 16px; }
  .updated { grid-area: upd; padding-inline-start: 20px; }
  .lang-toggle { grid-area: lang; }
  .theme-toggle { grid-area: theme; }
  .updated { font-size: 12px; }
  .toolbar-row { align-items: flex-start; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); scrollbar-width: none; width: calc(100% + var(--gutter) * 2); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .toolbar-end { width: 100%; justify-content: space-between; }

  .list-head { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main amount"
      "meta careers";
    row-gap: 10px; column-gap: 14px;
    padding: 16px 4px;
  }
  .row:hover { background: transparent; }
  .row-main { grid-area: main; }
  .row-desc { -webkit-line-clamp: 2; }
  .amount { grid-area: amount; align-self: start; font-size: 20px; }
  .row-meta { grid-area: meta; display: flex; align-items: center; gap: 10px; min-width: 0; }
  .careers { grid-area: careers; align-self: center; }
  .jobs { display: none; }  /* phone: the count shows under the Careers button */
  .row-hq { display: none; }
  .group-title { padding: 20px 4px 10px; }

  .drawer {
    top: auto; inset-inline-start: 0; width: 100%; max-height: 88vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(104%);
  }
  .drawer-grip { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--rule); margin: 10px auto 0; flex: none; }
  .drawer-close { top: 14px; inset-inline-end: 14px; }
  [dir="rtl"] .drawer:not(.open) { transform: translateY(104%); }
  .drawer-body { padding: 16px 20px 32px; }
  .d-title { font-size: 28px; }
}

/* Desktop: the row's date and stage sit in their own columns. */
@media (min-width: 761px) {
  .row-meta { display: contents; }
  .row > *, .row-meta > * { grid-row: 1; }
  .row-date { grid-column: 1; }
  .row-main { grid-column: 2; }
  .row .stage { grid-column: 3; }
  .amount { grid-column: 4; }
  .jobs { grid-column: 5; }
  .careers { grid-column: 6; }
  .jobs-count { display: none; }  /* desktop: the count has its own column */
}

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

/* category filter: its own line under the stage chips and the switches */
#category-chips { order: 3; flex-basis: 100%; }
#category-chips[hidden] { display: none; }

/* CV upload: drop zone, progress steps, results ------------------------------------------------- */
.cv { padding-bottom: clamp(20px, 4vw, 36px); }
.cv-title { margin: 0; font: 500 clamp(22px, 3vw, 30px)/1.2 var(--display); letter-spacing: -0.01em; }
.cv-intro { margin: 8px 0 18px; max-width: 40em; color: var(--ink-2); }

.cv-drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: clamp(24px, 5vw, 40px) 16px; border: 2px dashed var(--rule); border-radius: 14px; background: var(--surface);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.cv-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.cv-drop-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cv-drop-text { margin: 0; font: 500 17px/1.4 var(--display); color: var(--ink); }
.cv-privacy { margin: 10px 2px 0; font-size: 13px; color: var(--ink-3); }

.cv-choose, .cv-button {
  display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 18px;
  border: 1px solid var(--accent); border-radius: 999px; background: transparent; color: var(--accent);
  font: 600 14px/1 var(--sans); cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.cv-choose:hover, .cv-button:hover { background: var(--accent); color: var(--accent-ink); }
.cv-choose:active, .cv-button:active { transform: scale(0.97); }
.cv-choose.focus, .cv-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cv-work { padding: clamp(18px, 3vw, 26px); border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
.cv-work-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cv-now { margin: 0; font: 500 clamp(17px, 2.4vw, 20px)/1.35 var(--display); color: var(--ink); }
.cv-elapsed { flex: none; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 500; }
.cv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cv-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-3); }
.cv-step[data-status="current"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.cv-step[data-status="done"] { color: var(--ink-2); }
.cv-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule); position: relative; }
.cv-step[data-status="current"] .cv-mark { border-color: var(--rule); border-top-color: var(--accent); animation: cv-spin 0.8s linear infinite; }
.cv-step[data-status="done"] .cv-mark { background: var(--accent); border-color: var(--accent); }
.cv-step[data-status="done"] .cv-mark::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
@keyframes cv-spin { to { transform: rotate(360deg); } }
.cv-usually { margin: 14px 0 0; font-size: 13px; color: var(--ink-3); }

.cv-results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cv-results-title { margin: 0; font: 500 20px/1.3 var(--display); }
.cv-results-title:focus, .cv-error-text:focus { outline: none; }
.cv-results-count { color: var(--ink-3); font-size: 13px; }
.cv-cards { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.cv-card { padding: 14px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.cv-company { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cv-job-line { margin: 2px 0 0; font: 500 18px/1.35 var(--display); }
.cv-job { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a.cv-job:hover { text-decoration: underline; }
.cv-location { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.cv-why { margin: 8px 0 0; color: var(--ink); }
.cv-score { display: inline-block; margin-inline-start: 8px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 12px/1.6 var(--sans); vertical-align: middle; white-space: nowrap; }

.cv-error { padding: clamp(18px, 3vw, 26px); border: 1px solid var(--warn); border-radius: 14px; background: var(--warn-soft); }
.cv-error-text { margin: 0 0 14px; font: 500 17px/1.4 var(--display); color: var(--ink); }

/* Feedback button and box ------------------------------------------------- */
.fb-open {
  position: fixed; z-index: 45; bottom: 20px; inset-inline-start: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--sans);
  box-shadow: 0 10px 24px -8px rgba(20, 28, 60, 0.55), 0 0 0 4px var(--accent-soft); cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.fb-open::before {
  content: ""; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.fb-open:hover { transform: translateY(-2px); }
.fb-open:focus-visible, .fb-box button:focus-visible, .fb-box textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-box {
  position: fixed; z-index: 45; bottom: 76px; inset-inline-start: 20px;
  width: min(360px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--rule);
  border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.fb-title { margin: 0 0 10px; font: 600 16px/1.3 var(--display); }
.fb-box textarea {
  display: block; width: 100%; box-sizing: border-box; resize: vertical; padding: 10px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink);
  font: 400 14px/1.45 var(--sans);
}
.fb-note { margin: 8px 0 0; color: var(--ink-3); font-size: 12px; }
.fb-status { margin: 8px 0 0; font-size: 14px; }
.fb-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.fb-actions button { padding: 7px 14px; border-radius: 8px; font: 500 14px/1 var(--sans); cursor: pointer; }
.fb-cancel { border: 1px solid var(--rule); background: transparent; color: var(--ink-2); }
.fb-send { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.fb-send:disabled { opacity: 0.5; cursor: default; }
.fb-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
