/* =============================================================================
   Jobs board (/jobs) and a single posting (/jobs/slug)

   Design notes
   ------------
   The board reuses the site's existing vocabulary (navy hero, pills, cards)
   rather than inventing a second look. Two things differ deliberately:

   1. Cards are accent-bordered. A list of rows that all look alike is hard to
      scan; a 3px colour bar down the leading edge lets the eye track down the
      page and locate the role boundaries without extra borders.
   2. Badge colour is semantic, not decorative: green is remote, blue is
      hybrid, amber is on-site. Those three words are the first thing a visitor
      scans for, so colour does real work here.
   ========================================================================== */

/* Buttons (.btn, .btn-primary, .btn-outline ...) now live in base.css, shared by every page. */

/* --- Hero ---------------------------------------------------------------- */
.jobs-hero {
  background: linear-gradient(135deg, #1a1a4e 0%, #303078 50%, #1a1a4e 100%);
  color: var(--white);
  padding: 40px 0 0; position: relative; overflow: hidden;
}
.jobs-hero::after {
  content: ''; position: absolute; top: -60%; right: -12%; width: 640px; height: 640px;
  background: radial-gradient(circle, rgba(156,155,232,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.jobs-hero .wrap { position: relative; z-index: 1; }
.jobs-hero h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.85rem); line-height: 1.12;
  max-width: 17ch; margin-top: 10px; letter-spacing: -0.03em;
}
.jobs-hero .lead { max-width: 62ch; color: var(--slate-light); font-size: 1.05rem; }
.jobs-hero .breadcrumbs { margin-bottom: 22px; }
.jobs-hero-copy { padding-bottom: 26px; }

/* --- Controls bar -------------------------------------------------------- */
.jobs-controls {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: 20px 0;
}
/* One row: department, type, then the search box. flex-wrap lets it fall onto
   two rows on narrow screens instead of overflowing. */
.jobs-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.jobs-filters .jobs-select { flex: 0 0 auto; }

.jobs-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy-surface); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px; padding: 4px 6px 4px 14px;
  /* Grows to fill the rest of the row, so the three controls read as one bar
     rather than a fixed-width box floating beside the dropdowns. */
  flex: 1 1 260px; min-width: 200px;
  min-height: 48px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.jobs-search:focus-within { border-color: var(--primary); background: var(--navy-card); }
.jobs-search-icon { width: 16px; height: 16px; color: var(--slate); flex: 0 0 auto; }
.jobs-search input {
  border: none; outline: none; background: transparent; color: var(--white);
  font-family: var(--body); font-size: 0.88rem; width: 100%; min-width: 0;
}
.jobs-search input::placeholder { color: var(--slate); }
.jobs-search input::-webkit-search-cancel-button { filter: invert(0.6); }
.jobs-search-go {
  /* 40px inside a 48px-tall pill reads well and clears the tap guidance. */
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: var(--slate-light);
}
.jobs-search-go:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); }
.jobs-search-go svg { width: 16px; height: 16px; }

.jobs-type-form { display: flex; gap: 8px; align-items: center; }
.jobs-select {
  appearance: none; -webkit-appearance: none;
  background: var(--navy-surface); color: var(--slate-light);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px;
  /* 44px minimum tap height. */
  min-height: 44px;
  padding: 9px 34px 9px 15px; font-family: var(--body); font-size: 0.85rem;
  font-weight: 600; cursor: pointer;
  /* Inline chevron: no background image, so it recolours with the theme. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
.jobs-select:hover { border-color: rgba(255, 255, 255, 0.28); color: var(--white); }
.jobs-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.jobs-select option { background: var(--navy-card); color: var(--white); }
/* The department dropdown carries the most weight of the two, since it is the
   filter people use most, so it is allowed to breathe a little wider. */
.jobs-select[name="dept"] { font-weight: 700; }

/* --- Result count line --------------------------------------------------- */
.blog-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; padding: 26px 0 16px;
  color: var(--slate); font-size: 0.88rem; flex-wrap: wrap;
}
.blog-meta-count strong { color: var(--ink); font-weight: 700; }
/* Lifted from --muted to --slate on phones: it was 12.5px, which is at the
   edge of legibility for a sentence of running text. */
.blog-meta-note { color: var(--slate); }

/* --- Listing cards ------------------------------------------------------- */
.job-list { display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }

.job-row {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: start;
  padding: 24px 26px; background: var(--white);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
/* A soft indigo wash fades in from the left edge on hover. */
.job-row::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0;
  background: linear-gradient(100deg, var(--primary-light) 0%, rgba(237,237,251,0) 45%);
  transition: opacity 0.25s ease;
}
.job-row:hover { transform: translateY(-3px); border-color: var(--primary-border); box-shadow: 0 18px 36px -18px rgba(48, 48, 120, 0.35), var(--shadow-sm); }
.job-row:hover::before { opacity: 1; }
/* Keyboard focus lands on the title link; the ring goes on the whole card. */
.job-row:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
/* The whole card is one click target: the title link's ::after covers it. */
.job-row-main { min-width: 0; }
.job-row-title { position: static; }
.job-row-title a::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: 18px; }

.job-tile {
  width: 56px; height: 56px; border-radius: 16px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 800; font-size: 1rem; letter-spacing: 0.02em; color: var(--white);
  background: var(--hero-gradient); box-shadow: 0 10px 22px -10px rgba(48, 48, 120, 0.7), inset 0 0 0 1px rgba(255,255,255,0.14);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.job-row:hover .job-tile { transform: rotate(-4deg) scale(1.04); }

.job-row-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.job-dept { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary-ink); }
.job-new {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: #065F46; background: #D1FAE5; border-radius: 999px; padding: 3px 8px;
}
.job-row-title { font-size: 1.28rem; line-height: 1.3; color: var(--ink); letter-spacing: -0.02em; }
.job-row:hover .job-row-title { color: var(--primary-ink); }
.job-row-summary {
  color: var(--slate); font-size: 0.92rem; line-height: 1.6; margin-top: 6px;
  /* Two lines then an ellipsis, so every card keeps the same rhythm. */
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.job-row-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.job-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.76rem; font-weight: 700; line-height: 1; white-space: nowrap;
  color: var(--slate-dark); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px;
}
.job-badge svg { width: 14px; height: 14px; flex: 0 0 auto; }
/* Workplace is what people scan for, so it carries a colour. */
.job-badge-remote { color: #0E7C66; background: #E7F7F1; border-color: #BCE7DA; }
.job-badge-hybrid { color: var(--primary-ink); background: var(--primary-light); border-color: var(--primary-soft); }
.job-badge-onsite { color: #9A5B06; background: #FDF1DF; border-color: #F5DDB4; }
.job-badge-salary { color: var(--ink); background: var(--white); border-color: var(--line-strong); }
/* The job page hero still uses the plain .job-salary pill. */
.job-salary { font-size: 0.78rem; font-weight: 700; color: var(--ink); background: var(--primary-light); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }

.job-row-action {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 14px;
  align-self: stretch; flex: 0 0 auto;
}
.job-posted { font-size: 0.78rem; color: var(--slate); white-space: nowrap; }
.job-view {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px 0 18px;
  border-radius: 12px; font-weight: 700; font-size: 0.88rem; white-space: nowrap;
  color: var(--primary-ink); background: var(--primary-light); border: 1px solid var(--primary-soft);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.job-row:hover .job-view { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 8px 18px -8px rgba(91, 90, 196, 0.8); }
.job-row-arrow { width: 16px; height: 16px; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.job-row:hover .job-row-arrow { transform: translateX(3px); }

.job-list-ad { padding: 6px 0; }

/* --- Empty state --------------------------------------------------------- */
.jobs-empty {
  text-align: center; padding: 72px 24px 88px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--panel);
}
.jobs-empty-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: var(--radius-lg); margin-bottom: 20px;
  background: var(--white); border: 1px solid var(--line);
  color: var(--primary); font-family: var(--mono); font-weight: 800; font-size: 1.15rem;
  box-shadow: var(--shadow-xs);
}
.jobs-empty h2 { font-size: 1.3rem; color: var(--ink); margin-bottom: 10px; }
.jobs-empty p { color: var(--slate); max-width: 46ch; margin: 0 auto 24px; line-height: 1.65; }

/* =============================================================================
   Single posting
   ========================================================================== */
.job-hero { padding-bottom: 46px; }
.job-hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 44px; align-items: start;
}
.job-hero-copy { min-width: 0; }
.job-hero h1 {
  font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.6rem);
  line-height: 1.14; max-width: 22ch; margin-top: 12px; letter-spacing: -0.03em;
}
.job-hero .lead { max-width: 62ch; }

/* Facts sit as labelled columns under the intro, not as a boxed table.
   minmax is wide enough for a salary range: at 140px "$95,000 - $130,000/year"
   wrapped onto two lines and pushed the row out of alignment. */
.job-facts {
  list-style: none; margin: 28px 0 0; padding: 22px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 20px 28px;
}
.job-facts > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.job-facts dt {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--slate);
}
.job-facts dd {
  margin: 0; font-size: 0.94rem; font-weight: 600; color: var(--white);
  line-height: 1.4; text-wrap: balance;
}

/* The apply panel lives in the hero on purpose: it is above the fold and
   reachable without scrolling past a paragraph of description. */
.job-hero-apply {
  background: var(--navy-card); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg);
}
.job-hero-apply .btn { margin-bottom: 12px; }
.job-hero-apply-note { font-size: 0.85rem; color: var(--slate-light); line-height: 1.55; }
.job-hero-apply-mail {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem; color: var(--slate); word-break: break-all;
}

.job-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px; padding: 44px 0 80px; align-items: start;
}
.job-main { min-width: 0; }
.job-section { margin-top: 44px; }
.job-section h2 {
  font-size: 1.32rem; color: var(--ink); margin-bottom: 18px;
  letter-spacing: -0.02em; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.job-cover { margin: 0 0 32px; border-radius: var(--radius-lg); overflow: hidden; }
.job-cover img { display: block; width: 100%; }

/* Prose comes from TinyMCE, so it is styled by element, not by class.
   Spacing comes from one rule on every child rather than a `p { margin: 0 }`
   reset: a class+type selector would outrank it and collapse the gaps. */
.job-prose { color: var(--ink); font-size: 1rem; line-height: 1.75; }
.job-prose > *:first-child { margin-top: 0; }
.job-prose > * + * { margin-top: 20px; }
.job-prose h2 {
  font-size: 1.32rem; margin-top: 40px; color: var(--ink);
  letter-spacing: -0.02em; line-height: 1.3;
}
.job-prose h3 { font-size: 1.1rem; margin-top: 30px; color: var(--ink); }
.job-prose ul, .job-prose ol { margin: 0; padding-left: 22px; }
.job-prose li { margin-bottom: 8px; }
.job-prose li:last-child { margin-bottom: 0; }
.job-prose a { color: var(--primary-ink); font-weight: 600; text-decoration: underline; }
.job-prose img { border-radius: var(--radius-md); }
.job-prose blockquote {
  margin: 0; padding: 16px 20px; border-left: 3px solid var(--primary);
  background: var(--panel); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.job-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.job-bullets li {
  position: relative; padding-left: 28px; color: var(--ink); line-height: 1.68;
}
.job-bullets li::before {
  content: ''; position: absolute; left: 4px; top: 0.62em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); opacity: 0.75;
}

/* Perks read better as checkmarked cards than as another bullet list. */
.job-perks { display: flex; flex-direction: column; gap: 14px; }
.job-perks-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; }
.job-perk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.job-perk-list li { display: flex; gap: 11px; align-items: flex-start; line-height: 1.6; color: var(--ink); }
.job-perk-list svg {
  width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px;
  color: #0E7C66;
}

.job-apply-cta {
  margin-top: 44px; padding: 40px 32px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--white) 100%);
}
.job-apply-cta h2 { font-size: 1.45rem; color: var(--ink); margin-bottom: 10px; }
.job-apply-cta p { color: var(--slate); max-width: 54ch; margin: 0 auto 22px; line-height: 1.65; }

.job-related {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-xs);
}
.job-related li + li { border-top: 1px solid var(--line); }
.job-related a {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px;
  grid-template-areas: 'title arrow' 'meta arrow';
  align-items: center; column-gap: 16px; row-gap: 3px;
  padding: 17px 22px; transition: background-color 0.18s ease;
}
.job-related a:hover { background: var(--panel); }
.job-related-title {
  grid-area: title; font-weight: 700; color: var(--ink); line-height: 1.4;
}
.job-related a:hover .job-related-title { color: var(--primary-ink); }
.job-related-meta { grid-area: meta; font-size: 0.82rem; color: var(--slate); }
.job-related svg { grid-area: arrow; width: 18px; height: 18px; color: var(--slate-light); }
.job-related a:hover svg { color: var(--primary); }
.job-back { margin-top: 20px; }

.job-side { position: sticky; top: calc(var(--header-h) + 24px); }
.job-side-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--white); box-shadow: var(--shadow-sm); padding: 24px;
}
.job-side-title { font-size: 1rem; margin-bottom: 16px; color: var(--ink); }
.job-side-list { margin: 0 0 20px; }
.job-side-list > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.job-side-list > div:last-child { border-bottom: none; padding-bottom: 0; }
.job-side-list dt { color: var(--slate); font-size: 0.84rem; }
.job-side-list dd { margin: 0; font-weight: 700; font-size: 0.87rem; text-align: right; color: var(--ink); }
.job-side-card .ad-placement { margin-top: 20px; }

/* --- Pagination ---------------------------------------------------------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 36px 0 72px; flex-wrap: wrap;
}
.pagination a, .pagination .current {
  /* 44px is the smallest reliably tappable target on a phone. */
  min-width: 44px; height: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.9rem; font-weight: 600; color: var(--slate); background: var(--white);
  transition: all 0.18s ease;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-light); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: var(--white); }
.pagination .gap { color: var(--slate-light); padding: 0 2px; }

/* --- Responsive ----------------------------------------------------------
   Breakpoints follow the site's existing ones rather than device widths, so
   the jobs pages fold at the same points as the blog and courses pages. */
@media (max-width: 1100px) {
  .job-hero-grid, .job-layout { grid-template-columns: minmax(0, 1fr) 290px; gap: 36px; }
}
@media (max-width: 980px) {
  .job-hero-grid, .job-layout { grid-template-columns: 1fr; gap: 32px; }
  /* No order override here on purpose. The apply card does come first in the
     DOM so it is reachable early, but on a phone the title has to be seen
     before "Apply for this role" means anything. */
  .job-hero-copy { order: -1; }
  .job-side { position: static; }
  .job-side-card .btn-block { margin-top: 20px; }
}
@media (max-width: 760px) {
  .jobs-search { flex: 1 1 100%; }
  .jobs-filters .jobs-select { flex: 1 1 auto; }
  .job-row { grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; padding: 18px; }
  .job-tile { width: 46px; height: 46px; border-radius: 13px; font-size: 0.9rem; }
  .job-row-action { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); }
  .job-perks-2col { grid-template-columns: 1fr; }
  .job-apply-cta { padding: 30px 20px; }
  .job-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .jobs-hero { padding-top: 28px; }
  .jobs-hero h1, .job-hero h1 { font-size: 1.85rem; }
  .jobs-filters { gap: 8px; }
  .jobs-filters .jobs-select { flex: 1 1 100%; }
  .job-facts { grid-template-columns: 1fr; gap: 16px; }
  .job-row-title { font-size: 1.1rem; }
  .job-row-tags { gap: 6px; }
  .job-badge { font-size: 0.72rem; padding: 6px 9px; }
  .job-hero-apply { padding: 20px; }
}

@media print {
  .jobs-controls, .job-row-action, .job-hero-apply, .job-side, .ad-placement,
  .job-related, .job-apply-cta { display: none !important; }
  .jobs-hero, .job-hero { background: none; color: var(--ink); padding: 0; }
  .job-hero-grid, .job-layout { display: block; }
}
