/**
 * Job posting page (single-d4hhs_posting.php, inc/posting/top.php).
 *
 * The approved design is .mockups/posting-redesign/mockup.src.html; these are its rules,
 * value for value. The decisions behind them are in design-standards.md, "Job posting
 * page". Enqueued by inc/posting/assets.php on posting pages only.
 *
 * WHAT IS NOT HERE
 *   posting-body.css    the body typography (.jp-prose). The block editor loads that file.
 *   posting-apply.css   the application form: .jp-card and everything inside it.
 *   opps-search.css     the search bar. Only its spacing inside the band is set here.
 *   the plugin's blocks the operating area map (.d4hj-opmap), the hiring area map, the
 *                       ZIP check. They ship their own styles.
 *
 * Shared :root variables (--orange, --orange-bright, --maxw, fonts) come from global.css.
 */

/* =============================================================================
   Tokens. Every colour here already exists in the theme (global.css,
   page-opportunities.php, article.css) except the three status colours at the end,
   which are this page's own (the form's result messages and the ZIP check read them).
   ============================================================================= */
:root {
  --orange-border: #C74300;
  --slate: #576371;
  --gray-light: #EFF1F3;
  --charcoal: #2A2A2A;
  --prose: #4a4a4a;
  --hairline: rgba(87, 99, 113, 0.28);
  --ok: #17663A;      --ok-bg: #E7F3EB;
  --wait: #7A4E00;    --wait-bg: #FBF1DC;
  --stop: #9B1C1C;    --stop-bg: #FBEAEA;
}

.jp [hidden] { display: none !important; }
.jp :focus-visible,
.jp-bar :focus-visible { outline: 3px solid var(--orange-bright); outline-offset: 3px; }

/* ONE CONTAINER, edge to edge: the full window with a 40px gutter. It stops growing at
   1600px so a line of body text never gets too long to read on a very wide monitor.
   It is done by widening the site's own --maxw ON THIS PAGE ONLY (the body class the
   template adds), so the two shared parts that read it follow without being rewritten:
   the navigation (logo over the title, JOIN US over the form's right edge) and the
   Driver Hub gallery (its heading starts under the body text). */
body.d4hhs-posting-page { --maxw: 1600px; }
.jp-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }

/* =============================================================================
   01  THE TOP
   The site's dark band (photo at opacity 0.38 over solid black). One stack, left
   aligned: breadcrumb, title, the key facts, the buttons.
   ============================================================================= */
.jp-top {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;               /* the words sit in the middle of the photo below the navigation */
  min-height: clamp(460px, 64vh, 660px);
  background-color: #000000;
  color: #ffffff;
  padding: 116px 0 32px;             /* 84px fixed header + 32px, and 32px at the foot */
}
/* A posting with no featured image: the documented no-photo band, no image layer. */
.jp-top--plain { background-color: var(--charcoal); }
.jp-top > .jp-wrap { width: 100%; }
.jp-top__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  opacity: 0.38;                     /* the measured constant, verbatim */
  z-index: 1;
  pointer-events: none;
}
.jp-top .jp-wrap { position: relative; z-index: 2; }

/* The trail is printed by inc/breadcrumbs.php (Home, Opportunities, this posting). The
   last step would repeat the title that sits right under it, so it is not shown; Yoast's
   BreadcrumbList keeps all three steps. */
.jp-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; font-size: 14px; line-height: 1.4; }
.jp-crumbs li { color: rgba(255, 255, 255, 0.9); }
.jp-crumbs li[aria-current] { display: none; }
.jp-crumbs li + li::before { content: "\203A"; margin: 0 9px; color: rgba(255, 255, 255, 0.6); }
.jp-crumbs a { display: inline-block; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.45); }
.jp-crumbs a:hover { border-bottom-color: #ffffff; }

/* One stack, left aligned: title, the key facts, the buttons. Same order at every width. */
.jp-top__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "title" "facts" "actions";
  gap: 24px;
  margin-top: 8px;
}
.jp-title {
  grid-area: title;
  font-family: var(--display-font);
  font-size: clamp(56px, 5.4vw, 88px);
  font-weight: 400;                  /* Anton has one weight */
  line-height: 1.04;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

/* The key facts. A scrim card, the documented way to float a card on a band, so the
   labels hold contrast over any photo. One row here, one fact per row on a phone. */
.jp-facts {
  grid-area: facts;
  justify-self: start;               /* as wide as its words, not stretched across the window */
  max-width: 100%;
  display: grid;
  /* auto, not 1fr: each answer takes the room its words need. */
  grid-template-columns: repeat(4, auto);
  background: rgba(0, 0, 0, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
}
.jp-fact { padding: 16px 24px 18px; }
.jp-fact + .jp-fact { border-left: 1px solid rgba(255, 255, 255, 0.22); }
.jp-fact dt {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--orange-bright);
}
.jp-fact dd { margin-top: 6px; font-size: 20px; font-weight: 700; line-height: 1.3; color: #ffffff; }

.jp-actions { grid-area: actions; display: flex; gap: 12px; }
.jp-actions .jp-btn--primary { display: none; }   /* wide screens: the form is already beside the text */
.jp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 30px;
  border: 2px solid transparent;
  border-radius: 40px;
  font-family: var(--body-font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.jp-btn svg { flex: none; width: 20px; height: 20px; fill: currentColor; }
.jp-btn--primary { background: var(--orange); border-color: var(--orange-border); color: #ffffff; }
.jp-btn--primary:hover { background: var(--orange-border); }
.jp-btn--ghost { border-color: #ffffff; color: #ffffff; background: transparent; }
.jp-btn--ghost:hover { background: #ffffff; color: #000000; }
.jp-btn--dark { border-color: #111111; color: #111111; background: #ffffff; }
.jp-btn--dark:hover { background: #111111; color: #ffffff; }
.jp-btn--block { width: 100%; }

/* =============================================================================
   02  TEXT ON THE LEFT, THE FORM PINNED ON THE RIGHT
   The text is .jp-prose (posting-body.css). The form is .jp-card (posting-apply.css).
   ============================================================================= */
.jp-main { background: #ffffff; padding: 56px 0 84px; }
.jp-layout {
  display: grid;
  /* The form takes a third of the window, between 360px and 560px. */
  grid-template-columns: minmax(0, 1fr) clamp(360px, 34vw, 560px);
  gap: clamp(40px, 5vw, 80px);
  align-items: start;
}

/* The form column: pinned under the site header while the text scrolls. */
.jp-aside {
  position: sticky;
  top: 76px;                         /* the 60px scrolled header + 16px */
  scroll-margin-top: 76px;
}
/* The column takes focus when an Apply button sends the driver to it (posting.js). It is
   a region, not a control, so it shows no ring of its own. */
.jp-aside:focus { outline: none; }

/* =============================================================================
   03  SEARCH BAR
   The Opportunities hero, reused: its photo in the dark band recipe and its search
   component unchanged (inc/opps-search.php, opps-search.css).
   ============================================================================= */
/* A full screen of its own: the window's height (svh, so a phone's address bar does not
   push the search bar off the screen), with the heading and the bar in the middle. */
.jp-search {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  background-color: #000000;
  padding: 76px 24px 84px;
  text-align: center;
}
.jp-search__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  opacity: 0.38;
  z-index: 1;
  pointer-events: none;
}
.jp-search__inner { position: relative; z-index: 2; width: 100%; }
.jp-search__title {
  font-family: var(--display-font);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #ffffff;
}
/* The bar under this heading. Only where it sits is set here; how it looks is the
   component's. */
.jp-search .opps-search { max-width: 680px; margin: 26px auto 0; }

/* =============================================================================
   04  APPLY BAR (single-column widths only)
   Fixed to the bottom while the driver is between the top buttons and the form.
   Hidden by default so a page without JavaScript never has a bar over its footer.
   ============================================================================= */
.jp-bar { display: none; }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
/* Below 1024px there is no room for a side column: the form follows the text. */
@media (max-width: 1023px) {
  .jp-top__grid { gap: 20px; }
  .jp-actions .jp-btn--primary { display: inline-flex; }

  .jp-main { padding-bottom: 0; }
  .jp-layout { display: block; }
  .jp-aside {
    position: static;
    margin: 56px -40px 0;
    padding: 48px 40px 56px;
    background: var(--gray-light);
    scroll-margin-top: 60px;
  }

  .jp-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: #ffffff;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.22);
    transition: transform 0.22s ease;
  }
  .jp-bar.is-hidden { transform: translateY(115%); visibility: hidden; }
  .jp-bar .jp-btn--primary { flex: 1 1 0; }
  .jp-bar .jp-btn--dark { flex: none; width: 54px; padding: 0; }
}

@media (max-width: 860px) {
  .jp-wrap { padding: 0 24px; }
  /* A phone keeps the compact band: it already fills most of the first screen, and a
     taller one would push the key facts and the buttons below it. */
  .jp-top { min-height: 0; padding: 100px 0 28px; }
  .jp-crumbs li:first-child { display: none; }
  .jp-crumbs li + li::before { content: "\2039"; margin: 0 8px 0 0; color: #ffffff; }
  .jp-top__grid { gap: 16px; margin-top: 4px; }
  .jp-title { font-size: 40px; }

  .jp-facts { grid-template-columns: 1fr; padding: 2px 16px; }
  .jp-fact { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline; padding: 12px 0; }
  .jp-fact + .jp-fact { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.22); }
  .jp-fact dd { margin-top: 0; font-size: 17px; }

  .jp-facts { justify-self: stretch; }
  .jp-actions { gap: 10px; }
  .jp-actions .jp-btn { padding: 0 14px; font-size: 16px; }
  .jp-actions .jp-btn--primary { flex: 1 1 0; }
  /* "Join the waiting list" and the phone number do not fit one row on a phone, so on a
     waiting list posting the Call button may go under the Apply button. */
  .jp-actions--stack { flex-wrap: wrap; }

  .jp-main { padding-top: 40px; }

  .jp-aside { margin: 48px -24px 0; padding: 36px 24px 44px; }

  .jp-search { padding: 52px 24px 58px; }
  /* A phone shows a third of the photo's width: the tractor with the banner. */
  .jp-search__bg { object-position: 68% 50%; }
  .jp-search__title { font-size: 28px; }
  .jp-search .opps-search { margin-top: 20px; }
}

/* Narrower than the phones the design was drawn for: the two top buttons stack, so the
   phone number is never cut off at the edge of the band. */
@media (max-width: 374px) {
  .jp-actions { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .jp-btn, .jp-bar { transition: none; }
}
