/*
 * TechOffers — single token-driven stylesheet (ADR 0007, decision 3).
 *
 * Ordered sections: reset → tokens → base → layout → components → utilities.
 * Every selector here is reachable from the SSR views; there is no
 * client-framework CSS and no appended "second language" block. Light and
 * dark themes come from the semantic tokens below ([data-theme] with a
 * prefers-color-scheme fallback for the no-JS case).
 */

/* ------------------------------------------------------------------ */
/* 1. Reset                                                            */
/* ------------------------------------------------------------------ */

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

* {
  margin: 0;
}

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

body {
  min-height: 100dvh;
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

/* ------------------------------------------------------------------ */
/* 2. Design tokens                                                    */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Colour roles — light theme (default), drawn from the brand logo's
     parchment, deep-indigo and vivid-purple palette (ADR 0037). */
  --bg: #fbf7ec;
  --surface-1: #fffdf7;
  --surface-2: #f6efdd;
  --surface-3: #ece1c9;
  --text: #170c31;
  --text-muted: #605577;
  --border: #e4d9c4;
  --border-strong: #c9b895;
  --accent: #8b1fd4;
  --accent-hover: #7418b5;
  --accent-soft: #f7e9ff;
  --accent-contrast: #fffdf7;
  --success: #14713d;
  --success-soft: #e2f5e9;
  --warning: #8a5a00;
  --warning-soft: #fdf0d3;
  --danger: #b3261e;
  --danger-soft: #fce8e6;
  --focus-ring: 0 0 0 3px rgba(139, 31, 212, 0.4);

  /* Monogram avatar hues are generated inline via --avatar-hue. */
  --avatar-sat: 62%;
  --avatar-light: 88%;

  /* Spacing scale. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Type scale. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  --leading: 1.55;
  --leading-tight: 1.25;

  /* Radii, shadows, motion, structure. */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(27, 16, 44, 0.06);
  --shadow-2: 0 4px 16px rgba(27, 16, 44, 0.1);
  --z-topbar: 40;
  --z-apply-bar: 50;
  --z-skip-link: 100;
  --duration-fast: 120ms;
  --duration-slow: 240ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --container: 76rem;
  --topbar-height: 3.75rem;
}

[data-theme="dark"] {
  --bg: #0c0718;
  --surface-1: #151024;
  --surface-2: #1d1630;
  --surface-3: #291f42;
  --text: #f8f1dd;
  --text-muted: #b6aac8;
  --border: #332946;
  --border-strong: #4a3d64;
  --accent: #c084fc;
  --accent-hover: #d8b4fe;
  --accent-soft: #2b1a42;
  --accent-contrast: #12091f;
  --success: #4ade80;
  --success-soft: #12291b;
  --warning: #fbbf24;
  --warning-soft: #2e2410;
  --danger: #f87171;
  --danger-soft: #331516;
  --focus-ring: 0 0 0 3px rgba(192, 132, 252, 0.45);
  --avatar-sat: 48%;
  --avatar-light: 30%;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* No-JS fallback: follow the OS preference. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #0c0718;
    --surface-1: #151024;
    --surface-2: #1d1630;
    --surface-3: #291f42;
    --text: #f8f1dd;
    --text-muted: #b6aac8;
    --border: #332946;
    --border-strong: #4a3d64;
    --accent: #c084fc;
    --accent-hover: #d8b4fe;
    --accent-soft: #2b1a42;
    --accent-contrast: #12091f;
    --success: #4ade80;
    --success-soft: #12291b;
    --warning: #fbbf24;
    --warning-soft: #2e2410;
    --danger: #f87171;
    --danger-soft: #331516;
    --focus-ring: 0 0 0 3px rgba(192, 132, 252, 0.45);
    --avatar-sat: 48%;
    --avatar-light: 30%;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

/* ------------------------------------------------------------------ */
/* 3. Base                                                             */
/* ------------------------------------------------------------------ */

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text-md);
}

h1,
h2,
h3 {
  line-height: var(--leading-tight);
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-xl);
}

a {
  color: var(--accent);
  text-decoration-thickness: from-font;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

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

/* ------------------------------------------------------------------ */
/* 4. Layout                                                           */
/* ------------------------------------------------------------------ */

.main {
  min-height: calc(100dvh - var(--topbar-height) - 8rem);
}

.page-header {
  background:
    radial-gradient(60rem 24rem at 15% -40%, var(--accent-soft), transparent),
    var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.page-header__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-7) var(--space-5) var(--space-6);
  display: grid;
  /* Clamp the single column so the hero search cannot force a min-content
     width wider than a small viewport. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.page-header__inner > * {
  min-width: 0;
}

.page-header__subtitle {
  color: var(--text-muted);
  max-width: 46rem;
}

/* Two-column list: sticky filter rail + results (>=960px). */
.list-layout {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-5);
  display: grid;
  /* Explicit minmax(0, 1fr) track: on mobile an implicit `auto` track would
     size to the widest child's min-content and overflow the viewport. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

.list-layout__rail,
.list-layout__results {
  min-width: 0;
}

@media (min-width: 960px) {
  .list-layout {
    grid-template-columns: 17rem minmax(0, 1fr);
    align-items: start;
    padding: var(--space-6) var(--space-5) var(--space-8);
  }

  .list-layout__rail {
    position: sticky;
    top: calc(var(--topbar-height) + var(--space-4));
  }
}

/* Detail pages: single column with a readable measure. */
.detail-layout {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--space-5);
  display: grid;
  gap: var(--space-5);
}

.detail-layout--status {
  place-items: center;
  min-height: 50dvh;
}

/* The offer detail is long-form prose, so it keeps a comfortable reading
   measure. It stays wider than a pure text column so the cards/panels have
   room, and is centered for balanced padding. */
.detail-article {
  display: grid;
  gap: var(--space-6);
  width: 100%;
  max-width: 60rem;
  margin-inline: auto;
}

/* A company's open-roles section is a card grid, not prose: it fills the
   container so its columns can use the full width. */
.detail-roles {
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* 5. Components                                                       */
/* ------------------------------------------------------------------ */

/* --- Skip link ----------------------------------------------------- */

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-skip-link);
  padding: var(--space-3) var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

/* --- Topbar -------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-height);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: var(--container);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text);
}

.brand__mark {
  display: grid;
  place-items: center;
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-1);
  box-shadow: 0 0 0 1px var(--border);
}

/* The favicon itself is the mark (ADR 0037): one raster asset, no redrawn SVG. */
.brand__logo {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__text strong {
  font-size: var(--text-md);
}

.brand__text small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: var(--space-1);
  margin-inline-start: auto;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}

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

.topnav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.icon-btn {
  display: grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn .icon--moon {
  display: none;
}

[data-theme="dark"] .icon-btn .icon--sun {
  display: none;
}

[data-theme="dark"] .icon-btn .icon--moon {
  display: block;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Language switcher (ADR 0031): a two-option segmented control. Each option is
   an ordinary link, so the active language survives navigation without any
   client JS. `?lang` is part of the CloudFront cache key, so both renderings
   can be cached independently (`infra/cloudfront.tf`). */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.lang-switch__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding-inline: var(--space-2);
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.lang-switch__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.lang-switch__link[aria-current="true"] {
  color: var(--accent-contrast);
  background: var(--accent);
}

/* --- Search --------------------------------------------------------- */

.search {
  position: relative;
  display: flex;
  gap: var(--space-2);
  max-width: 40rem;
}

.search__icon {
  position: absolute;
  inset-inline-start: 0.9rem;
  inset-block-start: 50%;
  translate: 0 -50%;
  color: var(--text-muted);
  pointer-events: none;
}

.search input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding-inline: 2.6rem var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.search input:focus-visible {
  border-color: var(--accent);
}

.search__submit {
  flex-shrink: 0;
}

/* --- Filter panel ---------------------------------------------------- */

.filter-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.filter-panel__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.filter-panel__summary::-webkit-details-marker {
  display: none;
}

.filter-panel__chevron {
  margin-inline-start: auto;
  transition: rotate var(--duration-fast) var(--ease);
}

.filter-panel[open] .filter-panel__chevron {
  rotate: 180deg;
}

.filter-panel__body {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
}

@media (min-width: 960px) {
  .filter-panel__summary,
  .filter-panel__chevron {
    display: none;
  }

  .filter-panel__body {
    /* The rail is sticky, so a long facet list would otherwise run past the
       viewport with nothing to signal more filters. Bound it to the viewport
       and let it scroll on its own; the stable gutter avoids a layout shift
       when the scrollbar appears. The apply/clear actions keep pinning to the
       bottom of this scroll area. */
    max-block-size: calc(100dvh - var(--topbar-height) - var(--space-6));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    padding-top: var(--space-4);
    /* A scroll container's bottom padding sits outside the sticky actions'
       containing block, so a filter row could show through the strip below
       the buttons. Drop it and let the actions cover the bottom instead. */
    padding-bottom: 0;
  }

  .filter-form__actions {
    padding-bottom: var(--space-4);
  }

  /* Chromium on Linux/macOS uses overlay scrollbars that only show while
     scrolling; style the track/thumb so the rail's own scrollbar is always
     visible. */
  .filter-panel__body::-webkit-scrollbar {
    width: 10px;
  }

  .filter-panel__body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 2px solid var(--surface-1);
    border-radius: var(--radius-pill);
  }

  .filter-panel__body::-webkit-scrollbar-track {
    background: transparent;
  }
}

.filter-form {
  display: grid;
  /* One explicit minmax(0, 1fr) column: an implicit `auto` track would size to
     the widest child's min-content (the range/fieldset especially) and spill
     past the 17rem rail. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding-top: var(--space-4);
}

/* Let every facet shrink with the rail instead of holding its min-content. */
.filter-form > * {
  min-width: 0;
}

@media (min-width: 960px) {
  .filter-form {
    padding-top: 0;
  }
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
}

.field > * {
  min-width: 0;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.field input,
.field select {
  min-height: 44px;
  padding-inline: var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--accent);
}

/* --- Collapsible multi-select filter groups (ADR 0010) ---------------- */

.filter-group {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filter-group[open] {
  background: var(--surface-2);
}

.filter-group__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.filter-group__summary::-webkit-details-marker {
  display: none;
}

.filter-group__legend {
  flex: 1;
  min-width: 0;
}

.filter-group__count {
  display: inline-grid;
  place-items: center;
  min-inline-size: 1.5rem;
  block-size: 1.5rem;
  padding-inline: var(--space-1);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.filter-group__selected {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.filter-group__chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: rotate var(--duration-fast) var(--ease);
}

.filter-group[open] > .filter-group__summary .filter-group__chevron {
  rotate: 180deg;
}

.filter-group__options {
  display: grid;
  gap: var(--space-1);
  padding: 0 var(--space-3) var(--space-3);
}

/* Nested disclosure for the options beyond the visible limit. It makes the
   hidden items explicit ("Show N more") instead of relying on a scrollbar. */
.filter-group__more-summary {
  padding: var(--space-1) 0;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.filter-group__more-summary::-webkit-details-marker {
  display: none;
}

.filter-group__options--nested {
  padding: var(--space-1) 0 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  cursor: pointer;
  font-size: var(--text-sm);
}

.checkbox input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* --- Salary floor (range + unknown-salary checkbox) -------------------- */

.salary-filter {
  margin: 0;
  /* A <fieldset> defaults to `min-inline-size: min-content`, which would stop
     it shrinking below the range + output row and overflow the rail. */
  min-inline-size: 0;
  padding: var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.salary-filter__legend {
  padding-inline: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.salary-filter__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding-block: var(--space-2);
}

.salary-filter__range {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.salary-filter__value {
  flex-shrink: 0;
  min-width: 4.5rem;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* The apply/clear actions stick to the bottom of the viewport while the rail
   scrolls, so they are always reachable even with several groups expanded. */
.filter-form__actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  gap: var(--space-2);
  padding-block: var(--space-3);
  background: var(--surface-1);
}

.filter-form__actions::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-start: calc(-1 * var(--space-3));
  block-size: var(--space-3);
  background: linear-gradient(to top, var(--surface-1), transparent);
  pointer-events: none;
}

/* --- Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn--ghost {
  background: var(--surface-1);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--sm {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

/* --- Active filter chips ---------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.chips__label {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.chip__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}

.chip__link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chips__clear {
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-2);
}

/* --- Result toolbar ---------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  padding-block: var(--space-1);
}

.toolbar__count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.toolbar__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Cards -------------------------------------------------------------- */

.card-grid {
  display: grid;
  /* Single minmax(0, 1fr) column below 640px; an implicit `auto` track would
     take the card's min-content and overflow the viewport on narrow screens. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Company detail has no filter rail next to the results, so on wide screens
   the roles grid can afford a third column and fill the container. */
@media (min-width: 1100px) {
  .detail-roles .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.job-card,
.company-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.job-card:hover,
.company-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}

.job-card__head,
.company-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.job-card__head .badge,
.company-card__head .badge {
  margin-inline-start: auto;
  flex-shrink: 0;
}

.job-card__title,
.company-card__title {
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.job-card__heading,
.company-card__heading {
  font-size: var(--text-lg);
}

.job-card__heading a,
.company-card__heading a {
  color: var(--text);
  text-decoration: none;
}

.job-card__heading a:hover,
.company-card__heading a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* At-a-glance company row: name + type + industry, kept to a single line. The
   company type and industry chips always show their full label; only the
   company name yields space and clips with an ellipsis, so a long name cannot
   push a facet out or wrap the row. */
.job-card__company {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.job-card__company-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1 1 10rem;
  min-width: 0;
  color: var(--text);
}

.job-card__company-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Work-context row: location, work style and employment. A single neutral tone
   keeps it clearly apart from the accent-toned company taxonomy above. */
.job-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.job-card__salary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.job-card__salary.is-missing {
  color: var(--text-muted);
  font-weight: 400;
  font-size: var(--text-sm);
}

.job-card__excerpt,
.company-card__excerpt {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.job-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.job-card__foot,
.company-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.posted {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* --- Avatars ------------------------------------------------------------ */

.avatar {
  --avatar-bg: hsl(var(--avatar-hue, 278) var(--avatar-sat) var(--avatar-light));
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: var(--radius-md);
  background: var(--avatar-bg);
  color: hsl(var(--avatar-hue, 278) 45% 28%);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
}

[data-theme="dark"] .avatar {
  color: hsl(var(--avatar-hue, 278) 70% 85%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .avatar {
    color: hsl(var(--avatar-hue, 278) 70% 85%);
  }
}

.avatar--lg {
  inline-size: 3.5rem;
  block-size: 3.5rem;
  font-size: var(--text-md);
}

.avatar--xl {
  inline-size: 5rem;
  block-size: 5rem;
  border-radius: var(--radius-lg);
  font-size: var(--text-2xl);
}

/* Logo tiles use a neutral backdrop: source images are frequently
   transparent, so the monogram hue would bleed through or clash. */
.avatar--logo {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
}

.avatar__img {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  /* Logos are transparent and seldom square; contain keeps them whole. */
  object-fit: contain;
  padding: 10%;
}

/* --- Badges, tags, pills ------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem var(--space-2);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Company taxonomy chips: type and industry are deliberately identical in
   colour and shape, so they read as one company cluster. They never shrink, so
   their labels are always shown in full. */
.badge--company {
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem var(--space-2);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
}

.tag--level {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.tag--skill {
  background: transparent;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15rem var(--space-2);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.meta-pill .icon {
  flex-shrink: 0;
}

/* Work-context pills share one neutral colour and one max width. The label
   clips to a single line so a long location or remote phrasing never stretches
   the card. */
.meta-pill--context {
  max-width: 13rem;
}

.meta-pill--context > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Pagination ----------------------------------------------------------- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-3);
}

/* --- Empty and error states ------------------------------------------------ */

.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-state__icon {
  display: grid;
  place-items: center;
  inline-size: 3.5rem;
  block-size: 3.5rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
}

.empty-state--error .empty-state__icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state__title {
  font-size: var(--text-xl);
}

.empty-state__message {
  max-width: 40rem;
  color: var(--text-muted);
}

.empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

/* --- Detail pages ------------------------------------------------------------ */

.detail-back {
  display: flex;
  gap: var(--space-4);
}

.detail-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
}

.detail-hero {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.detail-hero__headings {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

.detail-company {
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.detail-actions .posted {
  margin-inline-end: auto;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.detail-fact {
  display: grid;
  gap: var(--space-1);
}

.detail-fact strong {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-fact span {
  font-weight: 500;
}

.detail-content {
  display: grid;
  gap: var(--space-6);
}

.detail-panel {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.detail-panel h2 {
  font-size: var(--text-lg);
}

.detail-list {
  display: grid;
  gap: var(--space-2);
  padding-inline-start: 1.25rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-roles__title {
  font-size: var(--text-xl);
}

/* Long-form description content (sanitised source HTML). */
.prose {
  display: grid;
  gap: var(--space-3);
  color: var(--text);
}

.prose h2,
.prose h3,
.prose h4 {
  margin-top: var(--space-2);
  font-size: var(--text-lg);
}

.prose ul,
.prose ol {
  display: grid;
  gap: var(--space-1);
  padding-inline-start: 1.25rem;
}

.prose a {
  overflow-wrap: anywhere;
}

/* Sticky apply bar: mobile-first, always-reachable apply action. */
.apply-bar {
  display: none;
}

@media (max-width: 719px) {
  .apply-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: var(--z-apply-bar);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4) max(var(--space-3), env(safe-area-inset-bottom));
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-2);
  }

  .apply-bar__body {
    display: grid;
    min-width: 0;
    margin-inline-end: auto;
  }

  .apply-bar__title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .apply-bar__company {
    color: var(--text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .apply-bar .btn {
    flex-shrink: 0;
  }

  /* Keep the fixed bar from covering the end of the detail content. */
  .detail-layout {
    padding-bottom: 5rem;
  }
}

/* --- Company profile header -------------------------------------------------- */

.company-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.company-header__body {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.company-header__name {
  font-size: var(--text-2xl);
}

.company-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.company-header__description {
  color: var(--text-muted);
  max-width: 60ch;
}

.company-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.company-facts__row dt {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.company-facts__row dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* 6. Utilities                                                        */
/* ------------------------------------------------------------------ */

.icon {
  inline-size: 1rem;
  block-size: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon--lg {
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

.sprite {
  position: absolute;
  inline-size: 0;
  block-size: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

