/* ==========================================================
   Aplify – Job Description Page
   Tokens defined in aplify-tokens.css (scoped to :root)
   ========================================================== */

.aplify-job-description {
  margin: 0 auto;
  font-family: var(--font-family);
  color: var(--fg);
}

/* ==========================================================
   LOADING / ERROR STATES
   ========================================================== */

.aplify-jd-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  padding: 60px 20px;
  text-align: center;
  font-family: var(--font-family);
  font-size: var(--font-size);
  color: var(--muted);
  gap: 16px;
}

.aplify-jd-loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--panel-border);
  border-top: 3px solid var(--highlight);
  border-radius: 50%;
  animation: aplify-spin 1s linear infinite;
  flex-shrink: 0;
}

@keyframes aplify-spin {
  to { transform: rotate(360deg); }
}

.aplify-jd-error {
  background: color-mix(in srgb, var(--highlight) 12%, white);
  color: var(--fg);
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

/* ==========================================================
   TITLE
   ========================================================== */

.aplify-jd-title {
  margin-top: 0;
  margin-bottom: 0;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem);
  line-height: 1.25;
  color: var(--hero-text-color, #fff);
  font-weight: var(--display-weight, 550);
  font-family: var(--font-family);
}

/* Inside the job description itself (a shortcode page with no hero of its
   own) the title sits on the page, not a photo: the hero's white text
   colour above made it invisible there. [aplify_job_title] in a hero keeps
   the hero colour. */
.aplify-job-description .aplify-jd-title {
  margin-bottom: 20px;
  color: var(--fg);
}

/* ==========================================================
   SUMMARY — aplify_jd_summary_html()
   Location and salary as icon lines, then the facts as chips in the job
   cards' own style (.job-category-badge / .job-hours-badge in
   search_form.css): category tinted in the brand colour, the rest neutral.
   Apply sits at the end of the chip row on desktop; at 768px and below the
   floating Apply takes over, and the chips become one line that swipes
   sideways so the block never grows taller than two lines and a row.

   .is-phone-only: the page's header ([aplify_job_header] or the flow hero)
   shows all of this on desktop, so it shows at 768px and below only.
   ========================================================== */

.aplify-jd-summary {
  margin: 0 0 28px;
  font-family: var(--font-family);
}

/* At the top of the description itself, a rule separates it from the text. */
.aplify-job-description .aplify-jd-summary {
  padding: 0 0 24px;
  border-bottom: var(--panel-border-w, 1px) solid var(--panel-border);
}

.aplify-jd-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--fg);
  font-size: var(--text-md, 16px);
}

.aplify-jd-lines li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.aplify-jd-lines i {
  flex-shrink: 0;
  font-size: 1.15em;
  color: var(--primary);
}

.aplify-jd-lines .is-salary {
  color: var(--highlight);
  font-weight: var(--weight-strong, 600);
}

.aplify-jd-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

.aplify-jd-chips {
  /* Takes the room Apply leaves and wraps inside it, so a long row breaks
     onto a second line of chips rather than pushing Apply underneath. */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aplify-jd-chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 14px;
  border-radius: var(--radius, 999px);
  background: var(--view-toggle-bg, #e6e9f0);
  color: var(--fg);
  font-family: var(--font-family);
  font-size: var(--text-sm, 13px);
  font-weight: var(--label-weight, 500);
  line-height: 1.35;
  white-space: nowrap;
}

.aplify-jd-chip.is-brand {
  background: rgb(from var(--primary) r g b / 0.08);
  color: var(--primary);
}

.aplify-jd-chip i {
  flex-shrink: 0;
  font-size: 1.1em;
}

@media (min-width: 769px) {
  .aplify-jd-summary.is-phone-only {
    display: none;
  }

  /* Phone-only, but the hero was told to leave the address out: keep that
     one line on desktop. */
  .aplify-jd-summary.is-phone-only.has-desktop-line {
    display: block;
  }

  .aplify-jd-summary.has-desktop-line .aplify-jd-summary-row,
  .aplify-jd-summary.has-desktop-line .aplify-jd-lines li:not(.is-desktop-too) {
    display: none;
  }

  .aplify-jd-summary.has-desktop-line .aplify-jd-lines {
    margin: 0;
  }
}

/* ==========================================================
   HEADER — [aplify_job_header], over a hero photo
   Title, then location and salary with their icons, then the facts as
   frosted chips. Text takes the hero text colour. At 768px and below only
   the title stays: the summary under the hero shows the rest.
   ========================================================== */

.aplify-job-header__inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aplify-job-header .aplify-jd-title {
  margin: 0;
  color: var(--hero-text-color, #fff);
  font-size: calc(var(--text-3xl, 32px) * 1.125);
  line-height: 1.2;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.aplify-job-header__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--hero-text-color, #fff);
  font-family: var(--font-family);
  font-size: var(--text-md, 16px);
  font-weight: var(--label-weight, 500);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.aplify-job-header__facts li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.aplify-job-header__facts i {
  font-size: 1.15em;
}

.aplify-jd-chips.is-on-photo {
  flex: none;
  margin-top: 4px;
}

.aplify-jd-chips.is-on-photo .aplify-jd-chip {
  background: rgba(255, 255, 255, 0.16);
  color: var(--hero-text-color, #fff);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.aplify-jd-chips.is-on-photo .aplify-jd-chip.is-brand {
  background: rgba(255, 255, 255, 0.26);
}

/* Just above the phone layout the hero is at its narrowest: slightly
   tighter chips keep a long job family and three facts on one line. */
@media (min-width: 769px) and (max-width: 900px) {
  .aplify-jd-chips.is-on-photo {
    gap: 6px;
  }

  .aplify-jd-chips.is-on-photo .aplify-jd-chip {
    padding: 6px 10px;
    gap: 5px;
  }
}

/* Location / salary with their icon, wherever they're shown on their own
   ([aplify_job_location], [aplify_job_salary]) — a client's hero or the
   Apply Flow's. Colour and size come from where they sit. */
.aplify-jd-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aplify-jd-fact i {
  flex-shrink: 0;
  font-size: 1.15em;
}

/* ==========================================================
   JOB BODY
   ========================================================== */

.aplify-jd-body {
  font-family: var(--font-family);
  font-size: var(--text-md, 16px);
  line-height: 1.7;
  color: var(--fg);
}

.aplify-jd-body h1,
.aplify-jd-body h2,
.aplify-jd-body h3,
.aplify-jd-body h4 {
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  color: var(--primary);
  font-weight: var(--display-weight, 550);
}

.aplify-jd-body h3 {
  font-size: var(--text-2xl, 24px);
  line-height: 1.3;
  font-weight: var(--display-weight, 550);
  color: var(--highlight);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.aplify-jd-body h2 {
  font-size: var(--text-2xl, 24px)!important;
  color: var(--primary);
}


.aplify-jd-body p {
  margin-block-start: 0.5em !important;
}

.aplify-jd-body ul,
.aplify-jd-body ol {
  padding-left: 20px!important;
  margin-bottom: 1.2em;
}

.aplify-jd-body li {
  margin-bottom: 0.5em;
}

/* ATS Typography Normaliser */
.aplify-jd-body,
.aplify-jd-body * {
  font-family: var(--font-family) !important;
  font-size: var(--text-md, 16px)!important;
  line-height: 1.7 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

/* ==========================================================
   APPLY SECTION
   ========================================================== */

.aplify-jd-apply {
    padding-top: 40px;
}

.aplify-jd-apply-btn,
a.aplify-jd-apply-btn,
a.aplify-jd-apply-btn:hover,
a.aplify-jd-apply-btn:focus,
button.aplify-jd-apply-btn  {
  text-decoration: none !important; /* a theme's link underline would otherwise win */
}

.aplify-jd-apply-btn,
a.aplify-jd-apply-btn,
button.aplify-jd-apply-btn  {
  display: flex;
  width: 100%;
  justify-content: center;
  background: var(--highlight);
  color: var(--button-text-color);
  padding: 18px 34px;
  border: none;
  border-radius: var(--btn-radius);
  font-size: var(--text-md, 16px);
  font-weight: var(--button-weight);
  font-family: var(--font-family);
  text-decoration: none;
  box-shadow: var(--button-shadow);
  transition: background .2s, box-shadow .2s, transform .05s;
  box-sizing: border-box;
}

.aplify-jd-apply-btn:hover {
  background: var(--primary);
  color: var(--button-text-color);
  box-shadow: var(--button-shadow-hover);
  text-decoration: none;
}

.aplify-jd-apply-btn i {
  margin-left: 8px;
  font-size: 1.15em;
  vertical-align: -0.12em;
  transition: transform .15s ease;
}

.aplify-jd-apply-btn:hover i {
  transform: translateX(3px);
}

/* The Apply at the end of the facts row: sized to its words, not the
   full-width bar at the bottom of the description. */
.aplify-jd-apply-btn.aplify-jd-apply-top {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  width: auto;
  padding: 12px 28px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .aplify-jd-apply-btn i {
    transition: none;
  }
}

.aplify-jd-apply-btn:active {
  transform: translateY(1px);
}

/* ==========================================================
   VIDEO EMBEDS
   ========================================================== */

iframe[src*="youtube.com"],
iframe[src*="youtu.be"] {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
  margin-bottom: 2rem;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 768px) {
  .aplify-job-description {
    padding: 0;
  }

  .aplify-jd-title {
    font-size: var(--text-2xl, 24px);
  }
	
	.aplify-jd-body h2 {
    font-size: var(--text-xl, 20px)!important;
}
	
	.aplify-jd-body, .aplify-jd-body * {
    font-size: var(--text-base, 14px)!important;
    line-height: 1.6 !important;
}

  /* The floating Apply button below covers these widths. */
  .aplify-jd-apply-btn.aplify-jd-apply-top {
    display: none;
  }

  .aplify-jd-summary {
    margin-bottom: 20px;
  }

  .aplify-job-description .aplify-jd-summary {
    padding-bottom: 20px;
  }

  /* One line of chips that swipes sideways; the fade at the right edge
     says there's more. Closing date and hours come first, so they're the
     ones seen without a swipe. */
  .aplify-jd-summary .aplify-jd-chips {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }

  .aplify-jd-summary .aplify-jd-chips::-webkit-scrollbar {
    display: none;
  }

  .aplify-jd-chip {
    padding: 6px 10px;
    gap: 5px;
  }

  /* Only the title stays on the photo on a phone. */
  .aplify-job-header__facts,
  .aplify-jd-chips.is-on-photo {
    display: none;
  }

  .aplify-job-header .aplify-jd-title {
    font-size: calc(var(--text-xl, 20px) * 1.2);
  }

  .aplify-jd-apply-btn {
    display: block;
    width: 100%;
    text-align: center;
  }
	.aplify-jd-apply-btn, a.aplify-jd-apply-btn, button.aplify-jd-apply-btn {
    padding: 26px 34px;
    border-radius: 0;
    position: fixed;
    bottom: 0;
    left: 0;
		z-index: 9999;
		font-size: var(--text-lg, 18px);
}
}
