/* ============================================================
   Hard Hat Benchmark — Training (learner side).
   Classes prefixed tr- (the SCORM player frame classes are tr-player*).
   Mobile-first — crews use phones — checked at 1280px too. Reuses
   .screen / .card / .card-body / .field / .banner / .status-line /
   .btn* / .tour-grid / .tour-thumb / .tour-add / .tour-del from
   styles.css rather than redefining them.

   The course list (My Training + Library) is TILES, per the approved
   mockup (docs/training/tile-mockup/training-tiles.html, 2026-09-24):
   a cover image, a kind badge, a hover/tap description, a category
   eyebrow, a status pill and tag pills, laid out in a responsive
   grid under a sticky search + chip toolbar. Colours come from this
   app's own tokens (--blue / --gold / --gray-* / --red / --green,
   styles.css) rather than the mockup's own palette. My certs still
   uses the older one-line .tr-row list — see certRowHtml in
   training.js — so those rules stay as they were.
   ============================================================ */

.tr-screen { padding-bottom: 24px; }

/* ---------- tabs ---------- */
.tr-tabs {
  display: flex; gap: 6px; margin-bottom: 12px;
  border-bottom: 1px solid var(--gray-2, #E5E7EB);
}
.tr-tab {
  appearance: none; border: none; background: none; cursor: pointer;
  padding: 10px 4px 10px; font: inherit; font-weight: 600; font-size: 14px;
  color: var(--gray-5, #667085); border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
}
.tr-tab-on { color: var(--ink, #1D2330); border-bottom-color: var(--blue, #0057B8); }
.tr-tab-n {
  font-size: 11px; font-weight: 700; background: var(--gray-1, #F2F4F7);
  color: var(--gray-5, #667085); border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.tr-tab-on .tr-tab-n { background: var(--blue-tint, #E8F0FC); color: var(--blue, #0057B8); }

/* ---------- one-line rows (My certs only) ---------- */
.tr-list { display: flex; flex-direction: column; gap: 6px; }
.tr-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--gray-2, #E5E7EB); border-radius: var(--radius-sm, 8px);
  padding: 12px 14px; cursor: pointer; font: inherit;
}
.tr-row:active { background: var(--gray-0, #FAFAFB); }
/* My team (training.js screenTrainingTeam): the same row, read-only, grouped
   under each person's name. */
.tr-row-static { cursor: default; box-sizing: border-box; }
.tr-row-static:active { background: #fff; }
.tr-team-name { font-weight: 700; font-size: 15px; color: var(--ink, #1D2330); margin: 18px 0 6px; }
.tr-team-person:first-child .tr-team-name { margin-top: 0; }
.tr-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-row-t { font-weight: 600; font-size: 15px; color: var(--ink, #1D2330); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-row-sub { font-size: 13px; color: var(--gray-5, #667085); }
.tr-row-cat { color: var(--gray-6, #4B5563); }

/* ---------- My series: a card per series above the course tiles ---------- */
.tr-ser-wrap { margin-bottom: 18px; }
.tr-ser-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-5, #667085); margin: 2px 0 8px; }
.tr-ser-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px; align-items: start; }
.tr-ser { background: #fff; border: 1px solid var(--gray-2, #E5E7EB); border-radius: 14px; padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 10px; }
.tr-ser-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tr-ser-name { margin: 0; font-size: 17px; font-weight: 700; }
.tr-ser-prog { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.tr-ser-bar { flex: 1 1 auto; height: 8px; border-radius: 999px; background: var(--gray-2, #E5E7EB); overflow: hidden; }
.tr-ser-bar div { height: 8px; border-radius: 999px; background: var(--green-dark, #2E5B1B); }
.tr-ser-step { display: flex; align-items: center; gap: 12px; min-height: 54px; border-top: 1px solid var(--gray-1, #F2F4F7); }
.tr-ser-mark {
  flex: none; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid var(--blue, #0057B8); color: var(--blue-dark, #00458F);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.tr-ser-mark .ic { width: 14px; height: 14px; }
.tr-ser-done .tr-ser-mark { background: var(--green-dark, #2E5B1B); border-color: var(--green-dark, #2E5B1B); color: #fff; }
.tr-ser-locked .tr-ser-mark { border-color: var(--gray-3, #C9C9C9); color: var(--gray-5, #667085); }
.tr-ser-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tr-ser-t { font-size: 15px; font-weight: 600; color: var(--ink, #1D2330); }
.tr-ser-sub { font-size: 13px; color: var(--gray-5, #667085); }
.tr-ser-locked .tr-ser-t { color: var(--gray-5, #667085); }
.tr-ser-go { flex: none; width: auto; }

/* ---------- tinted pills (cert rows + tile status pill) ---------- */
.tr-pill {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap;
}
.tr-pill-red { background: var(--red-tint, #F9E4E5); color: var(--red, #B3261E); }
.tr-pill-amber { background: var(--gold-tint, #FBF0CE); color: var(--gold-ink, #7A5C00); }
.tr-pill-green { background: var(--green-tint, #E4F2DC); color: var(--green-dark, #2E5B1B); }
.tr-pill-blue { background: var(--blue-tint, #E8F0FC); color: var(--blue, #0057B8); }
.tr-pill-quiet { background: var(--gray-1, #F2F4F7); color: var(--gray-5, #667085); }

/* ---------- course screen ---------- */
.tr-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.tr-facts > div { display: flex; flex-direction: column; gap: 2px; }
.tr-facts span { font-size: 12px; color: var(--gray-5, #667085); }
.tr-facts b { font-size: 15px; color: var(--ink, #1D2330); }
/* course page: one card — cover + facts beside the words + button (stacked on a phone) */
.tr-course { display: flex; flex-direction: column; gap: 16px; max-width: 1040px; }
.tr-course-side { display: flex; flex-direction: column; gap: 12px; }
.tr-course-art { border-radius: 14px; box-shadow: 0 1px 2px rgba(0,30,80,.06), 0 6px 18px rgba(0,30,80,.08); }
.tr-course-art-done { filter: saturate(.55); }
.tr-course-facts { margin: 0; }
.tr-course-facts .tr-facts { grid-template-columns: repeat(2, 1fr); }
.tr-course-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tr-course-title { margin: 0; font-size: 24px; line-height: 1.2; text-wrap: balance; }
.tr-course-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gray-5); flex-wrap: wrap; }
.tr-course-descr { margin: 4px 0 0; font-size: 15px; line-height: 1.5; max-width: 65ch; color: var(--gray-7, #444); }
.tr-course-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tr-course-acts .btn { width: auto; min-width: 180px; }

/* ---------- cert photos ---------- */
.tr-cert-photos { margin-top: 12px; }

/* ---------- the SCORM player ---------- */
.tr-player {
  position: fixed; inset: 0; z-index: 500; background: #000;
  display: flex; flex-direction: column;
}
.tr-player-bar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px; background: var(--ink, #1D2330); color: #fff;
}
.tr-player-bar-inline { border-radius: var(--radius-sm, 8px); }
.tr-player-t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The base .btn-outline is a white button; on the dark bar that made the
   label white-on-white — a blank box (2026-09-24). Transparent, light border. */
.tr-player-bar .btn { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); }
.tr-player-bar .btn:hover { background: rgba(255,255,255,.12); }
.tr-player-frame { flex: 1 1 auto; width: 100%; border: 0; background: #fff; }

@media (min-width: 900px) {
  .tr-facts { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- tags (tile body + course screen header) ---------- */
.tr-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tr-tag {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--gray-1, #F2F4F7); color: var(--gray-5, #667085);
}

/* =========================================================
   Toolbar — search, category/subcategory/tag chips, status
   segment, results line. Shown above the tile grid on My
   Training and Library only (not My certs).
   ========================================================= */
.tr-toolbar {
  position: sticky; top: 72px; z-index: 5;
  background: var(--gray-1, #F4F5F7);
  margin: 0 -2px; padding: 8px 2px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
@media (max-width: 380px) { .tr-toolbar { top: 64px; } }

.tr-search { position: relative; }
.tr-search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--gray-5); pointer-events: none; }
.tr-search input {
  width: 100%; min-height: var(--tap, 44px); padding: 0 66px 0 40px;
  border: 1.5px solid var(--gray-3, #C9C9C9); border-radius: var(--radius-sm, 8px);
  background: #fff; font-size: 16px; color: var(--ink);
}
.tr-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.15); }
.tr-search-clr {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; color: var(--gray-5); font: inherit; font-weight: 600; font-size: 13px;
}
.tr-search-clr:active { background: var(--gray-2); }

.tr-frow {
  display: flex; align-items: center; gap: 8px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
}
.tr-frow::-webkit-scrollbar { display: none; }
.tr-frow-lbl {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gray-5); min-width: 60px;
}
.tr-frow-lbl small { display: block; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--gray-5); }
.tr-subrow { background: var(--blue-tint, #E8F0FA); border-radius: 10px; padding: 6px 10px; }
.tr-subrow .tr-frow-lbl { color: var(--blue); }

.tr-chip {
  flex: none; height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--gray-2, #E5E7EB); background: #fff; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.tr-chip:active { border-color: var(--gray-3); }
.tr-chip-on { background: var(--blue, #0057B8); border-color: var(--blue); color: #fff; }
.tr-chip-sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tr-chip-cnt { font-size: 11px; font-weight: 700; color: var(--gray-5); margin-left: -2px; }
.tr-chip-on .tr-chip-cnt { color: inherit; opacity: .85; }
.tr-chip-on .tr-chip-sw { outline: 2px solid rgba(255,255,255,.75); }
.tr-chip-sub { height: 28px; font-size: 12px; border-color: transparent; background: #fff; }
.tr-chip-sub.tr-chip-on { background: var(--blue); color: #fff; }
.tr-chip-tag { height: 28px; padding: 0 11px; font-size: 12px; font-weight: 600; border-style: dashed; }
.tr-chip-tag.tr-chip-on { border-style: solid; }
.tr-chip-tag::before { content: "#"; opacity: .55; margin-right: -3px; }

.tr-seg {
  display: flex; gap: 4px; padding: 3px; background: var(--gray-2, #E4E4E4);
  border-radius: 9px; flex: none; margin-left: auto;
}
.tr-seg button {
  border: 0; background: none; height: 26px; padding: 0 12px; border-radius: 7px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--gray-5); cursor: pointer;
}
.tr-seg button .tr-seg-cnt {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px;
  background: rgba(0,0,0,.08); font-size: 11px; line-height: 18px; text-align: center;
}
/* The picked segment is solid blue on white — the old white-on-light-grey
   didn't read as "you are here" (user, 2026-09-30). */
.tr-seg-on, .tr-seg button.tr-seg-on { background: var(--blue, #1d4ed8); color: #fff; box-shadow: 0 1px 2px rgba(0,30,80,.18); }
.tr-seg button.tr-seg-on .tr-seg-cnt { background: rgba(255,255,255,.28); }

.tr-results { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--gray-5); font-size: 13px; }
.tr-clearall { border: 0; background: none; color: var(--blue); font: inherit; font-weight: 600; padding: 0; cursor: pointer; }

/* =========================================================
   Tiles
   ========================================================= */
.tr-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .tr-tile-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (max-width: 380px) { .tr-tile-grid { grid-template-columns: 1fr; } }

.tr-tile {
  position: relative; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--gray-2, #E5E7EB); border-radius: 14px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(0,30,80,.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
@media (hover: hover) { .tr-tile:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,30,80,.14); } }
.tr-tile-done .tr-tile-art { filter: saturate(.55); }

.tr-tile-art { position: relative; aspect-ratio: 1104 / 768; max-width: 100%; overflow: hidden; background: var(--gray-2); }
.tr-tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
@media (hover: hover) { .tr-tile:hover .tr-tile-img { transform: scale(1.04); } }
.tr-tile-solid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tr-tile-solid span {
  color: rgba(255,255,255,.75); font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; text-align: center; padding: 0 12px;
}

.tr-tile-kind {
  position: absolute; right: 10px; top: 10px; height: 26px; min-width: 26px; padding: 0 9px;
  border-radius: 999px; background: rgba(255,255,255,.94); color: var(--ink, #1A1A1A);
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  display: flex; align-items: center; gap: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.tr-tile-kind .ic { width: 12px; height: 12px; }
.tr-tile-kind-live { background: var(--red, #B4292E); color: #fff; text-transform: uppercase; }
.tr-tile-pulse { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: tr-pulse 1.6s infinite; }
@keyframes tr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.tr-tile-check {
  position: absolute; left: 10px; bottom: 10px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--green, #509E2F); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.tr-tile-check .ic { width: 16px; height: 16px; }

.tr-tile-desc {
  position: absolute; inset: 0; padding: 12px 13px;
  background: linear-gradient(to top, rgba(8,20,40,.97) 0%, rgba(8,20,40,.92) 55%, rgba(8,20,40,.6) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; pointer-events: none;
}
.tr-tile-desc p { margin: 0; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tr-tile-desc-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; opacity: .9; }
.tr-tile-btn { background: var(--gold, #FFC000); color: var(--ink, #1A1A1A); border: 0; border-radius: 8px; height: 32px; padding: 0 14px; font: inherit; font-weight: 700; font-size: 13px; flex: none; cursor: pointer; }
.tr-tile-btn-quiet { background: rgba(255,255,255,.2); color: #fff; cursor: default; }
@media (hover: hover) { .tr-tile:hover .tr-tile-desc { opacity: 1; transform: none; pointer-events: auto; } }
.tr-tile-open .tr-tile-desc { opacity: 1; transform: none; pointer-events: auto; }

.tr-tile-body { padding: 10px 13px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tr-tile-cat { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-5); min-width: 0; }
.tr-tile-cat .tr-chip-sw { flex: none; }
.tr-tile-cat-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-tile-cat-t b { color: var(--ink); font-weight: 800; }
.tr-tile-title { font-size: 15px; font-weight: 700; line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--gray-5); font-variant-numeric: tabular-nums; }
.tr-tile-meta > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-tile-meta .tr-pill { margin-top: auto; }

.tr-empty { grid-column: 1 / -1; padding: 40px 16px; text-align: center; color: var(--gray-5); border: 1px dashed var(--gray-2); border-radius: 14px; }
.tr-empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
  .tr-tile, .tr-tile-img, .tr-tile-desc { transition: none; }
  .tr-tile-pulse { animation: none; }
}

/* ---------- a computer: the whole window ----------
   The user's ask (2026-09-24): on a phone it stacks; in a browser it uses the
   whole screen. Same trick as .screen.df-xwide in styles.css — drop the
   640px cap, keep .screen's own padding and centering. */
@media (min-width: 900px) {
  .screen.tr-screen { max-width: none; width: 100%; box-sizing: border-box; padding-left: 24px; padding-right: 24px; }
  .tr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; align-items: stretch; }
  .tr-row { align-items: flex-start; padding: 14px 16px; }
  .tr-row-t { white-space: normal; }
  .tr-facts { grid-template-columns: repeat(5, 1fr); }
  /* Course screen: facts on the left, the Start / Resume button on the right. */
  .tr-course { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .tr-course-facts .tr-facts { grid-template-columns: repeat(2, 1fr); }
  .tr-course-title { font-size: 28px; }
}

/* Training is not job-scoped — the header's job chip has nothing to say on any
   Training screen (My Training, Library, certs, a course, the add-cert form),
   so it steps aside while one is on the glass. CSS rather than a call from
   every screen: the chip comes back by itself the moment #app shows anything
   else. (:has() — every browser this app supports has it.) */
body:has(#app > .tr-screen) #jobChip { display: none; }
