/* pm-ui.css — the redesigned learner pages' shared look.
 * ---------------------------------------------------------------------------
 * Agreed with Daniel on 22 Nov 2026 from the clickable mock-up (the learner
 * redesign: a dark navy header and top panel with rounded bottom corners,
 * white rounded cards on light grey, a green main button, small tinted icon
 * squares drawn in SVG, never emoji). The build spec is
 * C:\plumbmate-lab\learner-redesign\SPEC.md; its "Look" table is the token list
 * below, word for word.
 *
 * ONE FILE, SO THE LEVELS CANNOT DRIFT. Part 1 puts the header, the menu and
 * the Switch course sheet on the Level 2 written course. Parts 2 to 4 restyle
 * the Level 2 home, unit, lesson and revision pages from the same pieces, and
 * Level 1, Level 3 and the short courses take them up after that. A colour or
 * a radius changed here changes on every one of those pages at once.
 *
 * EVERYTHING IS NAMESPACED pm-. These pages already carry hundreds of lines of
 * their own CSS, some of it written as bare element rules (`header {...}`,
 * `a {...}`). Nothing here is a bare element rule, and every class starts pm-,
 * so loading this file cannot restyle a page body that has not been redesigned
 * yet. The header rules are written as header.pm-top so they outrank a page's
 * own bare `header` rule wherever one is still there.
 *
 * THE FONTS are the site's own (Daniel, 22 Nov 2026: keep the current fonts,
 * not Inter): Plus Jakarta Sans for the text (--pm-font) and Outfit for
 * headings (--pm-font-head), as level-2/l2-course.css has them. A page that
 * loads this file also links both from Google Fonts in its <head>; until they
 * arrive, or if they never do, the system font stands in.
 *
 * The behaviour (opening the menu and the sheet, what goes in them, who sees
 * the staff box) is /pm-header.js.
 * ---------------------------------------------------------------------------
 */

:root {
  /* navy: header, top panel */
  --pm-navy: #0f2942;
  --pm-navy-2: #18406a;
  --pm-panel: linear-gradient(180deg, #0f2942 0%, #18406a 100%);
  --pm-panel-radius: 28px;
  /* ground and cards */
  --pm-bg: #f1f5f9;
  --pm-card: #fff;
  --pm-line: #e2e8f0;
  --pm-card-radius: 18px;
  --pm-card-shadow: 0 1px 3px rgba(15, 23, 42, .05);
  /* the main button */
  --pm-green: #047857;
  --pm-green-hover: #065f46;
  /* links and accent */
  --pm-blue: #2563eb;
  --pm-blue-text: #1d4ed8;
  /* text: secondary is never lighter than this on the grey ground */
  --pm-text: #0f172a;
  --pm-text-2: #475569;
  /* amber: homework, next step */
  --pm-amber-fill: #fef3c7;
  --pm-amber-fill-2: #fffbeb;
  --pm-amber-text: #92400e;
  --pm-amber-line: #fcd34d;
  /* unit colours, in unit order (bars), with a darker shade for text */
  --pm-unit-1: #2563eb; --pm-unit-1-text: #1d4ed8;
  --pm-unit-2: #059669; --pm-unit-2-text: #047857;
  --pm-unit-3: #d97706; --pm-unit-3-text: #b45309;
  --pm-unit-4: #7c3aed; --pm-unit-4-text: #6d28d9;
  --pm-unit-5: #0284c7; --pm-unit-5-text: #0369a1;
  --pm-unit-6: #e11d48; --pm-unit-6-text: #be123c;
  --pm-unit-7: #0d9488; --pm-unit-7-text: #0f766e;
  --pm-unit-8: #4f46e5; --pm-unit-8-text: #4338ca;
  --pm-unit-9: #ea580c; --pm-unit-9-text: #c2410c;
  /* touch targets */
  --pm-touch: 44px;
  --pm-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pm-font-head: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── Cards and buttons ─────────────────────────────────────────────────── */
.pm-card {
  background: var(--pm-card); border: 1px solid var(--pm-line);
  border-radius: var(--pm-card-radius); box-shadow: var(--pm-card-shadow);
}
.pm-btn-main {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 52px; padding: 0 18px; border: 0; border-radius: 14px; box-sizing: border-box;
  background: var(--pm-green); color: #fff; font: 800 15px/1.2 var(--pm-font);
  text-decoration: none; cursor: pointer; box-shadow: 0 2px 8px rgba(4, 120, 87, .28);
}
.pm-btn-main:hover { background: var(--pm-green-hover); color: #fff; }
.pm-btn-outline {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 12px; box-sizing: border-box;
  background: #fff; border: 1.5px solid #cbd5e1; color: var(--pm-text);
  font: 700 14px/1.2 var(--pm-font); text-decoration: none; cursor: pointer;
}
.pm-btn-outline:hover { background: #f8fafc; color: var(--pm-text); }

/* ── Icon squares: 40px, radius 12 (34px in a list row) ───────────────── */
.pm-ic {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pm-ic svg { display: block; }
.pm-t-blue   { background: #dbeafe; color: #1d4ed8; }
.pm-t-green  { background: #d1fae5; color: #047857; }
.pm-t-amber  { background: #fef3c7; color: #b45309; }
.pm-t-violet { background: #ede9fe; color: #6d28d9; }
.pm-t-indigo { background: #e0e7ff; color: #4338ca; }
.pm-t-sky    { background: #e0f2fe; color: #0369a1; }
.pm-t-rose   { background: #ffe4e6; color: #be123c; }
.pm-t-slate  { background: #f1f5f9; color: #334155; }

/* ── The header ────────────────────────────────────────────────────────────
 * Logo (home) or a back link on the left, the course button in the middle,
 * the menu button on the right. Sticky, 60px, the same on a phone and a PC;
 * on a wide screen its contents line up with a centred column. */
/* The floating "Aa" reading-settings tab (pm-access.js): not on a page with
   this header, whose menu has "Reading and display" instead (Daniel, 22 Nov
   2026). pm-header.js also marks the page html.pm-has-top for browsers
   without :has. */
body:has(header.pm-top) #pmA-tab { display: none !important; }

header.pm-top {
  /* 100, as the old top bars were: the pages' own pop-outs (the unit page's
     Key facts, flashcards and key terms, z-index 500) and dialogs must still
     cover the header */
  position: sticky; top: 0; z-index: 100;
  display: block; height: auto; min-height: 0; margin: 0; padding: 0; border: 0;
  background: var(--pm-navy); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
  font-family: var(--pm-font); -webkit-font-smoothing: antialiased;
}
.pm-top-in {
  max-width: 1200px; margin: 0 auto; box-sizing: border-box;
  height: 60px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
@media (min-width: 768px) { .pm-top-in { padding: 0 24px; } }
.pm-top a, .pm-top button { font-family: var(--pm-font); -webkit-tap-highlight-color: transparent; }
.pm-top a:focus-visible, .pm-top button:focus-visible,
.pm-menu a:focus-visible, .pm-menu button:focus-visible,
.pm-sheet a:focus-visible, .pm-sheet button:focus-visible {
  outline: 3px solid #7dd3fc; outline-offset: 2px;
}
.pm-menu a:focus-visible, .pm-menu button:focus-visible,
.pm-sheet a:focus-visible, .pm-sheet button:focus-visible { outline-color: var(--pm-blue-text); }

.pm-top-brand {
  display: flex; align-items: center; gap: 9px; min-height: var(--pm-touch);
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.01em;
  text-decoration: none; flex-shrink: 0; font-family: var(--pm-font-head);
}
.pm-top-brand:hover, .pm-top-brand:visited { color: #fff; text-decoration: none; }
.pm-top-logo {
  width: 36px; height: 36px; box-sizing: border-box; border-radius: 11px;
  background: rgba(56, 189, 248, .16); border: 1px solid rgba(125, 211, 252, .35);
  display: flex; align-items: center; justify-content: center; color: #7dd3fc;
}
.pm-top-back {
  display: flex; align-items: center; gap: 4px; height: var(--pm-touch); padding: 0 10px 0 4px;
  border-radius: 12px; color: #bae6fd; font-weight: 700; font-size: 14px;
  text-decoration: none; flex-shrink: 0; white-space: nowrap;
}
.pm-top-back:hover, .pm-top-back:visited { color: #fff; text-decoration: none; }
.pm-top-back:hover { background: rgba(255, 255, 255, .08); }
.pm-top-course {
  display: flex; align-items: center; gap: 6px; min-width: 0; height: 40px; padding: 0 14px;
  border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  color: #e0f2fe; font-size: 13px; font-weight: 700; cursor: pointer; margin: 0;
}
.pm-top-course:hover { color: #fff; background: rgba(255, 255, 255, .16); }
.pm-top-course > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-top-course svg { flex-shrink: 0; }
.pm-top-ibtn {
  width: var(--pm-touch); height: var(--pm-touch); flex-shrink: 0; border-radius: 12px; border: 0; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: #e2e8f0; background: rgba(255, 255, 255, .08);
}
.pm-top-ibtn:hover { color: #fff; background: rgba(255, 255, 255, .16); }
/* A narrow phone keeps the logo and drops the word beside it, so the
   course button never squeezes the menu button off the edge. */
@media (max-width: 359px) { .pm-top-name { display: none; } .pm-top-course { padding: 0 11px; } }

/* ── The menu: a panel over the page, from the right ─────────────────────
 * Full width on a phone, 420px on a wider screen, with the page dimmed
 * behind it. */
.pm-scrim {
  position: fixed; inset: 0; z-index: 10000; background: rgba(15, 23, 42, .55);
  opacity: 0; transition: opacity .18s ease;
}
.pm-scrim.pm-on { opacity: 1; }
.pm-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10001;
  width: 100%; max-width: 420px; box-sizing: border-box;
  background: var(--pm-bg); color: var(--pm-text); font-family: var(--pm-font);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.4;
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(100%); transition: transform .2s ease;
  box-shadow: -12px 0 40px rgba(2, 6, 23, .25);
}
.pm-menu.pm-on { transform: none; }
@media (prefers-reduced-motion: reduce) { .pm-menu, .pm-sheet, .pm-scrim { transition: none; } }
.pm-menu-top {
  position: sticky; top: 0; z-index: 1; height: 60px; box-sizing: border-box; padding: 0 12px;
  background: var(--pm-navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pm-menu-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.pm-menu .pm-card { overflow: hidden; }
.pm-menu-who { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.pm-menu-av {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 999px; background: var(--pm-navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.pm-menu-who b { display: block; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.pm-menu-who small { display: block; font-size: 13px; color: var(--pm-text-2); overflow-wrap: anywhere; }
.pm-secH {
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: #334155; padding: 14px 16px 6px; margin: 0;
}
.pm-item {
  display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box;
  min-height: 54px; padding: 0 16px; margin: 0; border: 0; border-top: 1px solid #f1f5f9;
  background: none; color: var(--pm-text); font: 700 15px/1.3 var(--pm-font);
  text-align: left; text-decoration: none; cursor: pointer;
}
.pm-item:hover, .pm-item:visited { color: var(--pm-text); text-decoration: none; }
/* display:flex above would otherwise beat the browser's own rule for hidden */
.pm-item[hidden], .pm-opt[hidden], .pm-crs[hidden] { display: none; }
.pm-item:hover { background: #f8fafc; }
.pm-item .pm-ic { width: 34px; height: 34px; border-radius: 10px; }
.pm-item-end { margin-left: auto; color: #64748b; display: flex; align-items: center; gap: 8px; }
.pm-item-feedback, .pm-item-feedback:visited, .pm-item-feedback:hover { color: var(--pm-blue-text); }
.pm-item-feedback { background: #f8fbff; }
.pm-item-out, .pm-item-out:visited, .pm-item-out:hover { color: #be123c; }
.pm-count {
  font-size: 12px; font-weight: 800; color: var(--pm-amber-text); background: var(--pm-amber-fill);
  border-radius: 999px; padding: 3px 9px;
}
.pm-menu-staff { border: 1.5px dashed #94a3b8; background: #f8fafc; }
.pm-menu-staff .pm-item:hover { background: #f1f5f9; }

/* "Your course" rows in the menu, and the rows in the Switch course sheet */
.pm-crs {
  display: flex; align-items: center; gap: 12px; box-sizing: border-box; width: auto;
  padding: 12px 14px; margin: 0 12px 8px; border-radius: 14px; border: 1.5px solid var(--pm-line);
  background: #fff; color: var(--pm-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.pm-crs:hover, .pm-crs:visited { color: var(--pm-text); text-decoration: none; }
.pm-crs:hover { border-color: #93c5fd; }
.pm-crs b { display: block; font-size: 14px; font-weight: 800; }
.pm-crs small { display: block; font-size: 12px; color: var(--pm-text-2); margin-top: 1px; }
.pm-crs.pm-cur { border-color: var(--pm-blue); background: #eff6ff; }
.pm-badge {
  margin-left: auto; flex-shrink: 0; font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; color: var(--pm-blue-text);
}
.pm-cur .pm-badge { background: var(--pm-blue); color: #fff; }

/* ── The bottom sheet (Switch course) ────────────────────────────────────
 * Slides up from the bottom. On a phone it is the width of the screen; on a
 * wider one it is a 520px panel at the bottom, centred. */
.pm-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10001;
  width: 100%; max-width: 520px; max-height: 92vh; margin: 0 auto; box-sizing: border-box;
  background: var(--pm-bg); color: var(--pm-text); font-family: var(--pm-font);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.4;
  border-radius: 26px 26px 0 0; padding: 10px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(2, 6, 23, .3);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(100%); transition: transform .22s ease;
}
.pm-sheet.pm-on { transform: none; }
.pm-sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: #cbd5e1; margin: 0 auto 14px; }
.pm-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pm-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--pm-text); font-family: var(--pm-font-head); }
.pm-sheet-x {
  width: var(--pm-touch); height: var(--pm-touch); flex-shrink: 0; border: 0; border-radius: 999px;
  background: var(--pm-line); color: #334155; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pm-sheet-x:hover { background: #cbd5e1; }
.pm-sheet-sub { font-size: 13px; color: var(--pm-text-2); margin-top: 2px; }
.pm-sheet .pm-secH { padding: 0; margin: 18px 0 8px; }
.pm-opts { display: flex; flex-direction: column; gap: 8px; }
.pm-opt {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; box-sizing: border-box; width: 100%;
  border: 1.5px solid var(--pm-line); border-radius: 16px; background: #fff; color: var(--pm-text);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.pm-opt:hover, .pm-opt:visited { color: var(--pm-text); text-decoration: none; }
.pm-opt:hover { border-color: #93c5fd; }
.pm-opt b { display: block; font-size: 15px; font-weight: 800; }
.pm-opt small { display: block; font-size: 12px; color: var(--pm-text-2); margin-top: 2px; }
.pm-opt.pm-cur { border: 2px solid var(--pm-blue); background: #eff6ff; }
.pm-opt.pm-soon { background: #f8fafc; cursor: default; }
.pm-opt.pm-soon:hover { border-color: var(--pm-line); }
.pm-soon .pm-badge { background: var(--pm-line); color: #334155; }
.pm-num {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.pm-cur .pm-num { background: var(--pm-blue) !important; color: #fff !important; }
.pm-shorts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pm-short {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 12px; box-sizing: border-box;
  border: 1.5px solid var(--pm-line); border-radius: 14px; background: #fff;
  font-size: 14px; font-weight: 700; color: var(--pm-text); text-decoration: none; line-height: 1.25;
}
.pm-short:hover, .pm-short:visited { color: var(--pm-text); text-decoration: none; }
.pm-short:hover { border-color: #93c5fd; }
.pm-short i { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.pm-short.pm-cur { border: 2px solid var(--pm-blue); background: #eff6ff; }
.pm-short-all, .pm-short-all:visited { border-color: transparent; background: none; color: var(--pm-blue-text); font-weight: 800; }
.pm-sheet-note {
  margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--pm-line);
  font-size: 13px; color: #334155; line-height: 1.5;
}

/* While the menu or the sheet is open the page behind does not scroll. */
html.pm-locked, html.pm-locked body { overflow: hidden; }

@media print { header.pm-top, .pm-menu, .pm-sheet, .pm-scrim { display: none !important; } }
