/**
 * The application form card (inc/posting-apply-form.php): of a posting, and of a fixed
 * form on a page of the theme (the Florida page). One stylesheet for both.
 *
 * Everything inside .jp-card, taken from the approved mockup
 * (.mockups/posting-redesign/mockup.src.html). The column around the card (.jp-aside:
 * pinning, the gray band on single-column widths) belongs to posting.css.
 *
 * The card stands on its own: the colours it needs are declared on .jp-card, and the
 * button and the [hidden] rule are repeated here under .jp-card, so the form looks and
 * works the same whatever posting.css holds. --orange, --orange-bright and the two font
 * stacks come from global.css.
 *
 * Loaded on posting pages and on a page that carries a fixed form (inc/posting/assets.php).
 * /apply/ does not load it.
 *
 * .jp-card--flow is the card in a section of its own (the Florida page), where there is no
 * pinned column at any width: see the end of the responsive rules.
 */

.jp-card {
  --orange-border: #C74300;
  --slate: #576371;
  --gray-light: #EFF1F3;
  --hairline: rgba(87, 99, 113, 0.28);
  --ok: #17663A;      --ok-bg: #E7F3EB;
  --wait: #7A4E00;    --wait-bg: #FBF1DC;
  --stop: #9B1C1C;    --stop-bg: #FBEAEA;
}

/* A state that is not on the page is not on the page: rows, messages and the pinned
   button all set a display of their own, which would otherwise beat the attribute. */
.jp-card [hidden] { display: none !important; }
.jp-card :focus-visible { outline: 3px solid var(--orange-bright); outline-offset: 3px; }
/* The result and the "sent" message take focus from the script so a screen reader reads
   them. They are not controls, so they show no ring. */
.jp-card [tabindex="-1"]:focus { outline: none; }

/* --- The card: a white panel with a soft shadow, no outline. On a screen too short for
       the open form, the fields scroll inside the card and the Send button stays fixed
       at the card's foot, so the action is never out of sight. --- */
.jp-card {
  container-type: inline-size;       /* rows pair up by the card's own width, not the window's */
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 24px 28px 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
}
.jp-card::after { content: ""; display: block; height: 26px; }
.jp-card__title {
  margin-bottom: 4px;
  font-family: var(--display-font);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #111111;
}

/* --- Buttons (the page's .jp-btn, repeated for the two in the card) --- */
.jp-card .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-card .jp-btn--primary { background: var(--orange); border-color: var(--orange-border); color: #ffffff; }
.jp-card .jp-btn--primary:hover { background: var(--orange-border); }
.jp-card .jp-btn--block { width: 100%; }
/* While a request is under way the button says so and a second press does nothing.
   aria-disabled, not disabled, so the button keeps the keyboard focus while it waits. */
.jp-card .jp-btn[aria-disabled="true"] { opacity: 0.65; cursor: progress; }
.jp-card .jp-btn--primary[aria-disabled="true"]:hover { background: var(--orange); }

/* --- Form controls ---
   Sized so the open form fits the pinned column on a normal laptop screen without
   scrolling inside itself. Phones get larger controls further down. */
.jp-field { margin-top: 12px; border: 0; }
.jp-label { display: block; font-size: 14px; font-weight: 700; line-height: 1.4; color: #111111; }
.jp-label small { font-size: 14px; font-weight: 400; color: var(--slate); }
.jp-input,
.jp-select,
.jp-textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 5px;
  padding: 0 14px;
  border: 2px solid var(--slate);
  border-radius: 8px;
  background: #ffffff;
  font-family: var(--body-font);
  font-size: 17px;                   /* 16px and up keeps iOS from zooming on focus */
  line-height: 1.3;
  color: #111111;
  -webkit-appearance: none;
  appearance: none;
}
.jp-textarea { min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.jp-select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
.jp-input:focus, .jp-select:focus, .jp-textarea:focus { outline: 3px solid var(--orange-bright); outline-offset: 2px; border-color: #111111; }
.jp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
/* Phone and email share a row only when the card is wide enough to show a whole email
   address; the email side gets the larger share. */
.jp-row2--contact { grid-template-columns: 1fr; }
@container (min-width: 470px) {
  .jp-row2--contact { grid-template-columns: 2fr 3fr; }
}
.jp-error { margin-top: 6px; font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--stop); }
/* An error of the whole step sits over its button, where the driver is looking. */
.jp-send .jp-error { margin: 0 0 10px; }

/* CDL experience: one bar of five, shaped like the fields around it. One tap, every
   answer in view, nothing to open. The words "in years" sit in the label, so each cell
   holds only its number; the value sent is still the full answer. */
/* Built so it cannot fall short of the full width: the five cells share the row equally
   (flex), and each cell draws its own border instead of sitting inside a clipped frame.
   Neighbours overlap by the border width, so the dividers stay single lines. */
.jp-seg { display: flex; width: 100%; margin-top: 5px; }
.jp-seg__cell { position: relative; display: block; flex: 1 1 0; min-width: 0; }
.jp-seg__cell + .jp-seg__cell { margin-left: -2px; }
.jp-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.jp-seg span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--slate);
  background: #ffffff;
  font-size: 16px;
  font-weight: 700;
  color: #111111;
}
.jp-seg__cell:first-child span { border-radius: 8px 0 0 8px; }
.jp-seg__cell:last-child span { border-radius: 0 8px 8px 0; }
.jp-seg input:hover + span { background: var(--gray-light); }
.jp-seg input:checked + span { z-index: 1; border-color: #111111; background: #111111; color: #ffffff; }
.jp-seg input:focus-visible + span { z-index: 2; outline: 3px solid var(--orange-bright); outline-offset: 2px; }

/* Result messages: a tinted box, an icon and a first line that says the outcome in
   words. Never colour alone. No edge stripe. */
.jp-msg {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 2px 12px;
  margin-top: 16px;
  padding: 14px 16px 15px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
  color: #111111;
}
.jp-msg svg { grid-row: 1 / span 3; width: 24px; height: 24px; margin-top: 1px; fill: currentColor; }
.jp-msg__title { grid-column: 2; font-weight: 700; font-size: 17px; line-height: 1.4; }
.jp-msg__text { grid-column: 2; }
.jp-msg__more { grid-column: 2; margin-top: 8px; }
.jp-msg--ok   { background: var(--ok-bg); }
.jp-msg--wait { background: var(--wait-bg); }
.jp-msg--stop { background: var(--stop-bg); }
.jp-msg--ok   svg, .jp-msg--ok   .jp-msg__title { color: var(--ok); }
.jp-msg--wait svg, .jp-msg--wait .jp-msg__title { color: var(--wait); }
.jp-msg--stop svg, .jp-msg--stop .jp-msg__title { color: var(--stop); }
.jp-msg a { color: #111111; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* "Change" sits inside the result box, after the answers it would change. */
.jp-link { padding: 0; border: 0; background: none; font: 700 16px/1.5 var(--body-font); color: #111111; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.jp-note { margin-top: 4px; }
.jp-note summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 700; color: #111111; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; list-style: none; }
.jp-note summary::-webkit-details-marker { display: none; }
.jp-note[open] summary { display: none; }
.jp-note[open] { margin-top: 12px; }

.jp-send { margin-top: 16px; }
.jp-send--pin {
  position: sticky;
  bottom: 0;
  margin: 12px 0 -14px;
  padding: 12px 0;
  background: #ffffff;
  border-top: 1px solid var(--hairline);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
/* Below 1024px there is no side column: the form follows the text, at its full height,
   and the gray band behind it (posting.css) frames it, so the card drops its shadow. */
@media (max-width: 1023px) {
  .jp-card { max-width: 560px; max-height: none; margin: 0 auto; overflow: visible; box-shadow: none; }
  .jp-send--pin { position: static; margin: 16px 0 0; padding: 0; border-top: 0; }
}

/* The card in a section of its own (.jp-card--flow, the Florida page): the same rules at
   every width, because the page has no side column to pin it in. A centred card, 560px at
   most, at its full height, on the band its section draws. */
.jp-card--flow { max-width: 560px; max-height: none; margin: 0 auto; overflow: visible; box-shadow: none; }
.jp-card--flow .jp-send--pin { position: static; margin: 16px 0 0; padding: 0; border-top: 0; }

/* Phones: larger type and larger tap targets. */
@media (max-width: 860px) {
  .jp-card { padding: 22px 20px 0; }
  .jp-card::after { height: 24px; }
  .jp-field { margin-top: 16px; }
  .jp-card__title { font-size: 26px; }
  .jp-msg { font-size: 17px; }
  .jp-label { font-size: 16px; }
  .jp-input, .jp-select { min-height: 54px; font-size: 18px; }
  .jp-seg span { min-height: 54px; font-size: 17px; }
}

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