/* HailCare: people screens (messages and profiles). Keep this small; prefer the shared
   components in hailcare-ui.css. */

/* ---- Inbox (/messages) ------------------------------------------------------
   Each row is one link: the other side's initials, then the name and time,
   the shift (its title cut short so the date always shows) and the last
   line. Unread rows set the time and last line in ink semibold and end with
   the orange count. */
.people-inbox > li { padding: 0; }
.people-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas:
    "avatar name time"
    "avatar shift shift"
    "avatar last last";
  column-gap: var(--sp-4); row-gap: 2px; align-items: baseline;
  padding: var(--sp-5);
  color: var(--ink); text-decoration: none;
  transition: background-color var(--dur-color) var(--ease);
}
/* The rows fill the list's card: the first and last take its corners. */
.people-inbox > li:first-child > .people-row { border-radius: calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0 0; }
.people-inbox > li:last-child > .people-row { border-radius: 0 0 calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px); }
.people-inbox > li:only-child > .people-row { border-radius: calc(var(--r-lg) - 1px); }
.people-row.is-unread { grid-template-areas: "avatar name time" "avatar shift shift" "avatar last badge"; }
.people-row:hover { color: var(--ink); background: var(--fill); }
.people-row:hover .people-row__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.people-row:focus-visible { outline-offset: -3px; }
/* position: relative keeps the screen-reader text inside the clipped name, so a
   long unread name can't widen the page. */
.people-row > * { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-row__avatar { grid-area: avatar; align-self: start; width: 48px; height: 48px; font-size: 18px; }
.people-row__name { grid-area: name; font-size: var(--fs-lead); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.people-row__time { grid-area: time; color: var(--muted); font-size: var(--fs-meta); font-variant-numeric: tabular-nums; }
.people-row__shift { grid-area: shift; display: flex; color: var(--muted); font-size: var(--fs-meta); }
.people-row__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.people-row__date { flex: none; font-variant-numeric: tabular-nums; }
.people-row__last { grid-area: last; margin-top: 2px; color: var(--muted); }
.people-row.is-unread .people-row__last, .people-row.is-unread .people-row__time { color: var(--ink); font-weight: var(--fw-semibold); }
.people-row > .badge-count { grid-area: badge; justify-self: end; align-self: center; overflow: visible; }

/* Names, titles, places and license numbers are user text: long unbroken ones
   wrap instead of widening the page. */
.people-wrap, .people-ev, .people-list { overflow-wrap: anywhere; }

/* ---- Thread (/messages/:id) and first message (/jobs/:id/messages/new) ------
   One readable column: the name, the shift the conversation is about, then
   the messages (theirs grey on the left, yours petrol on the right) and the
   box. */
.people-chat { max-width: var(--form); }
.people-chat .page-head { margin-bottom: var(--sp-3); }
/* The shift: one tappable row under the name, then a hairline above the messages. */
.people-shift {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-4); border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--rule); box-shadow: var(--shadow-card);
  color: var(--ink); text-decoration: none;
  transition: border-color var(--dur-color) var(--ease), box-shadow var(--dur-color) var(--ease);
}
.people-shift:hover { color: var(--ink); border-color: var(--rule-strong); box-shadow: var(--shadow-raised); }
.people-shift:hover .people-shift__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.people-shift:focus-visible { outline-offset: 2px; border-radius: var(--r-lg); }
.people-shift__body { display: grid; gap: var(--sp-1); flex: 1 1 auto; min-width: 0; }
.people-shift__title { color: var(--primary); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.people-shift__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); color: var(--muted); font-size: var(--fs-meta); }
.people-shift > .ico { color: var(--muted); }
/* The name links to the profile; vertical padding makes it a 44px target without moving the line. */
.people-name { padding-block: 4px; color: inherit; text-decoration: none; }
.people-name:hover { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.people-thread { list-style: none; display: grid; gap: var(--sp-3); margin-bottom: var(--sp-7); padding-top: var(--sp-6); border-top: 1px solid var(--rule); }
.people-day, .people-ev { text-align: center; color: var(--muted); font-size: var(--fs-meta); }
.people-day { margin-top: var(--sp-4); font-weight: var(--fw-semibold); }
.people-day:first-child { margin-top: 0; }
/* Balanced lines keep the time with the end of the sentence when it wraps. */
.people-ev { padding: var(--sp-1) var(--sp-4); text-wrap: balance; }
.people-ev__at { white-space: nowrap; }
.people-msg { display: grid; justify-items: start; gap: var(--sp-1); }
.people-msg--mine { justify-items: end; }
/* Theirs: a white card on the left. Yours: petrol on the right. */
.people-msg__bubble {
  max-width: min(85%, 520px); padding: 10px 16px; border-radius: 20px 20px 20px 6px;
  background: var(--card); border: 1px solid var(--rule); box-shadow: var(--shadow-card); color: var(--ink);
}
.people-msg--mine .people-msg__bubble { background: var(--primary); border-color: transparent; color: var(--primary-ink); border-radius: 20px 20px 6px 20px; }
.people-msg__time { color: var(--muted); font-size: var(--fs-caption); padding: 0 var(--sp-1); font-variant-numeric: tabular-nums; }
@media (forced-colors: active) { .people-msg__bubble { border: 1px solid CanvasText; } }

/* Closed: the note takes the box's place. A phlebotomist gets "Find shifts". */
.people-closed a { font-weight: var(--fw-semibold); white-space: nowrap; }

/* "#latest" sits after the message box (or the closed note): it lands with the box
   just above the bottom edge and the phone tab bar, newest rows above it. */
.people-latest { display: block; scroll-margin-top: calc(100vh - 16px); scroll-margin-top: calc(100svh - 16px); }
@media (max-width: 767px) {
  .people-latest {
    scroll-margin-top: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom) - 16px);
    scroll-margin-top: calc(100svh - var(--tabbar-h) - env(safe-area-inset-bottom) - 16px);
  }
}

/* The message box with Send beside it; an error runs below both. The box
   grows with its text, from one line up to about ten (field-sizing, or
   public/js/app.js where that is unsupported). The first message starts at
   four lines, below a hairline. */
.people-composer { gap: var(--sp-4); }
.people-composer__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-3); align-items: end; }
.people-composer__row > .err { grid-column: 1 / -1; }
.people-composer .textarea { field-sizing: content; min-height: var(--control-h); max-height: 280px; resize: none; }
.people-composer--first { padding-top: var(--sp-6); border-top: 1px solid var(--rule); }
.people-composer--first .textarea { min-height: 132px; }

/* ---- Profile (/users/:id) ---------------------------------------------------
   Avatar, name and role; three facts set large; then the sections. From
   960px the sections use the page width in two columns: certifications and
   About on the left, ratings on the right. */
.people-body { margin-top: var(--sp-9); }
@media (min-width: 960px) {
  .people-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--sp-9); align-items: start; }
  .people-body > .section { grid-column: 1; }
  .people-body > .people-ratings:not(:first-child) { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}
.people-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-7); }
.people-head > .page-head__text { flex: 1 1 14rem; }
/* Beside the name from 600px; under it, full width, on phones. */
.people-head__edit { flex: 1 1 100%; }
@media (min-width: 600px) { .people-head__edit { flex: none; margin-left: auto; } }
@media (min-width: 768px) { .people-head__avatar { width: 80px; height: 80px; font-size: 30px; } }
/* Labels on one row, values on the next, so the values line up even when a
   label wraps. */
.people-facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto; grid-auto-flow: column;
  gap: var(--sp-1) var(--sp-4); padding: var(--sp-5);
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.people-facts > div { display: contents; }
.people-facts dt { align-self: end; color: var(--muted); font-size: var(--fs-meta); }
.people-facts dd { font-size: var(--fs-figure); font-weight: var(--fw-bold); line-height: 1.25; overflow-wrap: anywhere; }
.people-facts .rating strong { font-weight: var(--fw-bold); }
.people-facts .rating .ico { width: 18px; height: 18px; }
.people-facts .rating .muted { font-size: var(--fs-meta); font-weight: var(--fw-regular); }
@media (min-width: 768px) { .people-facts { column-gap: var(--sp-7); } }

/* Certification rows: the short label, the full name below it, then the
   license number and expiry (a pill when it is soon or past). */
.people-cert__label { font-size: var(--fs-lead); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.people-cert__name { margin-top: 2px; color: var(--muted); font-size: var(--fs-meta); }
.people-cert__meta { margin-top: var(--sp-1); color: var(--muted); font-size: var(--fs-meta); }
/* "Self-reported" beside each certification's label. */
.people-cert__label .pill { margin-left: var(--sp-1); vertical-align: 2px; }

/* About: the description, then the years of experience. */
.people-about > :not(.section__head) + * { margin-top: var(--sp-2); }

.people-review__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-3); margin: calc(var(--sp-3) * -1) 0 0; }
.people-review__head a { display: inline-flex; align-items: center; min-height: 44px; font-weight: var(--fw-semibold); }
.people-review .small { margin-top: var(--sp-1); }

/* ---- Edit profile (/profile) -----------------------------------------------
   One form column, left-aligned like Post shift; fieldsets 40px apart. The
   certifications fieldset sits in #credentials (the target of "Add
   certification" links). */
.people-form { max-width: var(--form); }
.people-form .form { gap: var(--sp-5); }
.people-form .fieldset + .fieldset { margin-top: 0; }
/* "Add certification" (/profile#credentials) lands with the legend clear of the top edge. */
.people-certs { scroll-margin-top: var(--sp-6); }
