/* ============================================================
   Lediga jobb (/jobb, /en/jobb and the job pages generated from the
   native "jobs" collection). Loaded only on those four templates, after
   animed.css, whose tokens it uses. Layout steps are @container queries
   against .uk-container, like the rest of the site.
   ============================================================ */

:root {
  --jb-aside-w: 22rem;
  --jb-sticky-top: 6.5rem;
}

/* ------------------------------------------------------------ shared */
/* animed.css gives every <p> its own colour and size; paragraphs inside these
   containers (CMS richtext included) follow the container instead. */
.jb-prose p, .jb-post-intro p, .jb-apply-text p { color: inherit; font-size: inherit; line-height: inherit; }
.jb-pill { align-self: flex-start; display: inline-flex; align-items: center; padding: 4px 11px; border-radius: var(--radius-pill); background: var(--animed-teal-100); color: var(--animed-teal-800); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1.3; }

.jb-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--jb-aside-w); gap: var(--space-12); align-items: start; }
.jb-aside { position: sticky; top: var(--jb-sticky-top); display: flex; flex-direction: column; gap: var(--space-4); }
@container (max-width: 880px) {
  .jb-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }
  .jb-aside { position: static; }
}

/* Long Swedish compounds ("Verksamhetskoordinator") must wrap on small phones. */
.jb-card-title, .jb-post-title { overflow-wrap: break-word; hyphens: manual; }
@container (max-width: 420px) { .jb-post-title { hyphens: auto; } }

/* ------------------------------------------------------------ job cards */
.jb-main { padding-bottom: var(--space-20); }
.jb-list-title { margin: var(--space-12) 0 var(--space-6); }
.jb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.jb-item { display: flex; }
.jb-card { flex: 1; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out); }
.jb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--animed-teal-300); color: inherit; }
.jb-card:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 3px; }
.jb-card-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); line-height: 1.2; letter-spacing: -0.015em; color: var(--fg-default); }
.jb-card-text { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--fg-muted); max-width: 62ch; text-wrap: pretty; }
.jb-card-link { margin-top: var(--space-1); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9375rem; color: var(--fg-link); }
.jb-card-link svg { transition: transform var(--dur-base) var(--ease-out); }
.jb-card:hover .jb-card-link svg { transform: translateX(3px); }
.jb-empty { padding: var(--space-6); border: 1px dashed var(--border-default); border-radius: var(--radius-lg); color: var(--fg-muted); font-size: 0.9375rem; }

.jb-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.jb-facts li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill); background: var(--animed-cream-100); color: var(--animed-ink-700); font-size: 0.8125rem; font-weight: 500; line-height: 1.3; }
.jb-facts svg { flex: none; color: var(--animed-teal-800); }
/* The job area sits first in the row, same height as the chips beside it. */
.jb-facts li.jb-pill { padding: 5px 11px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.02em; background: var(--animed-teal-100); color: var(--animed-teal-800); }

/* "Fler lediga tjänster" under a job page: two columns where there is room. */
.jb-list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (max-width: 720px) { .jb-list--grid { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ "Så söker du" */
.jb-apply { background: var(--animed-teal-900); color: rgba(255, 255, 255, 0.82); border-radius: var(--radius-lg); padding: var(--space-8) var(--space-6); box-shadow: var(--shadow-md); }
.jb-apply-title { margin: 0 0 var(--space-6); font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; line-height: 1.2; letter-spacing: -0.015em; color: #fff; }
.jb-apply a:not(.uk-btn) { color: var(--animed-amber-300); }
.jb-apply a:not(.uk-btn):hover { color: #fff; }
.jb-apply-btn { width: 100%; gap: 8px; margin-top: var(--space-6); }
.jb-apply-text { font-size: 0.9375rem; line-height: 1.65; }
.jb-apply-text p { margin: 0 0 var(--space-3); }
.jb-apply-text p:last-child { margin-bottom: 0; }
.jb-apply-text strong { color: #fff; }
.jb-apply-posted { margin: var(--space-4) 0 0; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.6); text-align: center; }

.jb-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-5); }
.jb-step { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: var(--space-4); }
/* The line joining the step numbers. */
.jb-step:not(:last-child)::before { content: ""; position: absolute; left: calc(1rem - 1px); top: 2.25rem; bottom: calc(-1 * var(--space-5) + 0.25rem); width: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.16); }
.jb-step-n { width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--animed-amber-500); color: var(--animed-teal-900); font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; }
.jb-step-title { margin: 0.3rem 0 0.25rem; font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.3; color: #fff; }
.jb-step-text { margin: 0; font-size: 0.875rem; line-height: 1.6; color: rgba(255, 255, 255, 0.78); }

/* ------------------------------------------------------------ why AniMed */
.jb-why-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); margin-top: var(--space-8); }
@container (max-width: 960px) { .jb-why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 540px) { .jb-why-grid { grid-template-columns: minmax(0, 1fr); } }
.jb-why-item { background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-6); }
.jb-why-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: var(--animed-teal-100); color: var(--animed-teal-800); }
.jb-why-title { margin: var(--space-4) 0 var(--space-2); font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.jb-why-text { margin: 0; font-size: 0.875rem; line-height: 1.6; color: var(--fg-muted); }

/* ------------------------------------------------------------ job page */
.jb-post-hero { background: var(--animed-cream-100); padding-bottom: var(--space-12); margin-bottom: var(--space-12); }
.jb-post-head { display: flex; flex-direction: column; align-items: flex-start; max-width: 52rem; }
.jb-post-title { margin: 0 0 var(--space-5); font-size: clamp(2.2rem, 4.4vw, 3.5rem); }
.jb-post-intro { font-size: 1.15rem; line-height: 1.6; color: var(--animed-ink-700); max-width: 62ch; text-wrap: pretty; }
.jb-post-intro p { margin: 0 0 var(--space-4); }
.jb-post-intro p:last-child { margin-bottom: 0; }
.jb-post-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }
.jb-post-actions .uk-btn { gap: 8px; }
@container (max-width: 30rem) { .jb-post-actions .uk-btn { flex: 1 1 100%; } }

.jb-keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-3); width: 100%; margin: var(--space-8) 0 0; }
.jb-keyfact { background: var(--bg-surface); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm); }
.jb-keyfact dt { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
.jb-keyfact dt svg { color: var(--animed-teal-800); }
.jb-keyfact dd { margin: 6px 0 0; font-family: var(--font-display); font-weight: 600; font-size: 1rem; line-height: 1.35; color: var(--fg-default); }

/* In-page contents: one chip per section the entry actually has. */
.jb-toc ul { list-style: none; margin: 0 0 var(--space-10); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.jb-toc a { display: inline-flex; padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--animed-ink-700); font-size: 0.875rem; font-weight: 600; text-decoration: none; transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.jb-toc a:hover { border-color: var(--animed-teal-800); color: var(--animed-teal-800); }

.jb-sec { scroll-margin-top: 1rem; }
.jb-sec + .jb-sec { margin-top: var(--space-10); padding-top: var(--space-10); border-top: 1px solid var(--border-subtle); }
.jb-sec-title { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-5); font-family: var(--font-display); font-weight: 600; font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem); line-height: 1.2; letter-spacing: -0.015em; }
.jb-sec-icon { flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: var(--animed-teal-100); color: var(--animed-teal-800); }

.jb-prose { font-size: 1.0625rem; line-height: 1.7; color: var(--fg-default); max-width: 68ch; }
.jb-prose p { margin: 0 0 var(--space-4); text-wrap: pretty; }
.jb-prose > :last-child { margin-bottom: 0; }
.jb-prose h3 { margin: var(--space-6) 0 var(--space-3); font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; line-height: 1.3; }
.jb-prose ul { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; gap: var(--space-3); }
.jb-prose li { position: relative; padding-left: 2rem; }
/* Teal check in a tinted circle instead of a bullet. */
.jb-prose li::before { content: ""; position: absolute; left: 0; top: 0.22em; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--animed-teal-100) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E6868' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.75rem no-repeat; }

/* "Vad erbjuder vi?" written as <li><strong>Rubrik</strong> text</li>
   becomes a grid of small cards; plain lists keep the check style. */
.jb-prose--perks ul:has(> li > strong:first-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.jb-prose--perks li:has(> strong:first-child) { padding: var(--space-5); background: var(--bg-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); font-size: 0.9375rem; line-height: 1.6; color: var(--fg-muted); }
.jb-prose--perks li:has(> strong:first-child)::before { display: none; }
.jb-prose--perks li > strong:first-child { display: block; margin-bottom: var(--space-1); font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--fg-default); }
@container (max-width: 640px) { .jb-prose--perks ul:has(> li > strong:first-child) { grid-template-columns: minmax(0, 1fr); } }

.jb-back { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.jb-more { margin: var(--space-16) 0 var(--space-20); padding-top: var(--space-10); border-top: 1px solid var(--border-subtle); }
.jb-more .uk-h3 { margin-bottom: var(--space-5); }

@media (prefers-reduced-motion: reduce) {
  .jb-card, .jb-card-link svg { transition: none; }
  .jb-card:hover { transform: none; }
}
