/* ==========================================================================
   Photon Academy, past papers viewer 2026 (/papers/ and, in part B, /worksheets/), built by js/paper-viewer.js.
   Loads after css/site-2026-app.css and uses its tokens: --ink --ink2 --mute --navy --ok --line --chalk --canvas
   --r --ctl --sh --fu --fd and the shell geometry --psh-top --psh-rail --psh-bottom.

   Rules of the road
   - Every selector is under a pv- class. body.app26 strips <button> and <a> styles with zero-specificity rules, so each
     control here carries its own class.
   - The viewer has two layouts, split at 900px: from 900px a bar with the controls, the list beside the viewer, the two
     documents side by side; under 900px one document at a time, the list is a sheet from the bottom and Questions |
     Markscheme, Download and Print sit in a bar at the bottom.
   - States are attributes (aria-pressed, aria-current, aria-expanded, hidden); data-view on #pvApp says which parts show.

   1 Frame and bar     2 Controls     3 List     4 Viewer and panes     5 Phones     6 Booklet viewer (js/photon-booklet.js)
   ========================================================================== */

/* ---------- 1. Frame and bar ---------- */
.pv-root { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.pv { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: #fff; position: relative; }
.pv-ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pv :focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.pv-bar { flex: none; position: relative; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 56px; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-sp { flex: 1 1 0; min-width: 0; }
.pv-bk { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.pv-bk .pl-bk-btn { min-width: var(--ctl); justify-content: center; }
.pv-bk .pl-bk-btn[hidden] { display: none !important; }

/* the two-line name button of phones: hidden from 900px, where the name sits in the viewer bar */
.pv-nsw { display: none; }
.pv-over { font: 600 10px/1.1 var(--fu); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-nm { font: 500 15px/1.2 var(--fu); color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.pv-nsw__t { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pv-nsw__c { width: 14px; height: 14px; stroke: var(--mute); stroke-width: 2.2; }

/* ---------- 2. Controls ---------- */
.pv-ctls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.pv-seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.pv-seg > button, .pv-seg > a { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl); padding: 0 14px; border: 0; border-radius: 0; background: #fff; color: var(--ink); font: 500 13.5px/1.1 var(--fu); white-space: nowrap; text-decoration: none; cursor: pointer; }
.pv-seg > * + * { border-left: 1px solid var(--line); }
.pv-seg > button:hover, .pv-seg > a:hover { background: var(--chalk); }
.pv-seg > button[aria-pressed="true"], .pv-seg > a[aria-current="page"] { background: var(--ink); color: #fff; }
.pv-sel { position: relative; display: inline-flex; max-width: 100%; min-width: 0; }
.pv-sel select { appearance: none; -webkit-appearance: none; max-width: 100%; min-width: 0; height: var(--ctl); padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font: 500 14px/1.2 var(--fu); text-overflow: ellipsis; cursor: pointer; }
.pv-sel select:hover { border-color: var(--ink2); }
.pv-sel--subj select { max-width: 340px; }
.pv-sel__c { position: absolute; right: 11px; top: 50%; width: 14px; height: 14px; margin-top: -7px; stroke: var(--ink2); stroke-width: 2.2; pointer-events: none; }
.pv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--ctl); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font: 500 13.5px/1 var(--fu); white-space: nowrap; text-decoration: none; cursor: pointer; }
.pv-btn:hover { background: var(--chalk); border-color: var(--ink2); }
.pv-btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; gap: 7px; }
.pv-btn--sm .pv-ic { width: 15px; height: 15px; stroke-width: 1.8; }
.pv-btn[hidden] { display: none !important; }

/* ---------- 3. List ---------- */
.pv-body { flex: 1; min-height: 0; min-width: 0; display: flex; position: relative; background: var(--canvas); }
.pv-scrim { display: none; padding: 0; border: 0; cursor: default; }
.pv-list { flex: none; width: clamp(264px, 26vw, 320px); display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--line); }
.pv-body.is-collapsed .pv-list { display: none; }
.pv-so { display: none; }
.pv-lh { flex: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); }
.pv-note { flex: 1; min-width: 0; font: 400 12.5px/1.4 var(--fu); color: var(--mute); }
.pv-hide { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 6px; border: 0; border-radius: var(--r); background: none; color: var(--ink2); font: 600 11px/1 var(--fu); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; cursor: pointer; }
.pv-hide:hover { color: var(--ink); background: var(--chalk); }
.pv-hide .pv-ic { width: 14px; height: 14px; stroke-width: 2.2; }
.pv-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.pv-oldp { flex: none; margin: 0; padding: 6px 16px; border-top: 1px solid #edf0f4; font: 400 12.5px/1.4 var(--fu); }
.pv-oldp a { display: inline-flex; align-items: center; min-height: 32px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.pv-oldp a:hover { color: var(--ink); }
.pv-gh { position: sticky; top: 0; z-index: 2; margin: 0; padding: 14px 16px 6px; background: #fff; font: 600 13px/1.2 var(--fu); color: var(--ink); }
/* A row is drawn only when it is near the screen: the largest School list has 710 */
.pv-row { content-visibility: auto; contain-intrinsic-size: auto 53px; }
.pv-row:not(.pv-row--one) { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 6px 12px 6px 16px; border-bottom: 1px solid #edf0f4; background: #fff; }
.pv-row.is-on:not(.pv-row--one) { background: var(--chalk); }
.pv-rl { flex: 1 1 64px; min-width: 0; font: 500 14px/1.3 var(--fu); overflow-wrap: anywhere; }
.pv-row.is-on .pv-rl { font-weight: 600; }
.pv-bs { flex: 0 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pv-b { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 40px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font: 600 13px/1 var(--fu); cursor: pointer; }
.pv-b:hover { border-color: var(--ink2); background: var(--chalk); }
.pv-b[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pv-row--one { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 8px 16px 8px 13px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid #edf0f4; border-radius: 0; background: #fff; color: var(--ink); font: 500 14px/1.3 var(--fu); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.pv-row--one:hover { background: var(--chalk); }
.pv-row--one.is-on { background: var(--chalk); border-left-color: var(--navy); font-weight: 600; }
.pv-empty { padding: 24px 16px; font: 400 14px/1.5 var(--fu); color: var(--ink2); }

/* ---------- 4. Viewer and panes ---------- */
.pv-view { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pv-vbar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 56px; padding: 6px 12px 6px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-show { margin-left: -8px; }
.pv-vt { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-vt strong { font: 600 15.5px/1.25 var(--fu); overflow-wrap: anywhere; }
.pv-vt span { font: 400 12.5px/1.3 var(--fu); color: var(--mute); overflow-wrap: anywhere; }
.pv-acts { flex: none; display: inline-flex; gap: 8px; }
.pv-panes { flex: 1; min-height: 0; display: flex; }
.pv-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; container-type: inline-size; container-name: pvpane; }
.pv-div { flex: none; width: 1px; background: var(--line); }
.pv[data-view="q"] .pv-pane[data-part="ms"], .pv[data-view="ms"] .pv-pane[data-part="q"], .pv[data-view="q"] .pv-div, .pv[data-view="ms"] .pv-div { display: none; }
.pv-phead { flex: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 12px 6px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-ptitle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font: 600 12px/1.2 var(--fu); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.pv-pt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a narrow pane (two documents side by side in a small window): Print and Download keep their icons and lose their words */
@container pvpane (max-width: 470px) { .pv-phead { padding-left: 12px; padding-right: 8px; gap: 6px; } .pv-phead .pv-btn { width: 36px; padding: 0; } .pv-phead .pv-bl { display: none; } }
.pv-dot { flex: none; width: 8px; height: 8px; border-radius: 1px; background: var(--navy); }
.pv-dot--ms { background: var(--ok); }
.pv-pn { flex: none; font: 500 13px/1 var(--fu); color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv-pages { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; background: var(--canvas); padding: 18px 16px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pv-pages:focus-visible { outline-offset: -2px; }
.pv-pages .pg { flex: none; position: relative; width: min(100%, 900px); background: #fff; box-shadow: var(--sh); }
.pv-pages .pg canvas { display: block; width: 100%; height: 100%; }
.pv-msg { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 320px; font: 400 14.5px/1.5 var(--fu); color: var(--ink2); text-align: center; }
.pv-printframe { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

/* the bar at the bottom: phones only */
.pv-act { display: none; flex: none; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px 10px; background: #fff; border-top: 1px solid var(--line); }
.pv-seg--act { flex: 1; min-width: 0; }
.pv-seg--act > button { flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; font-size: 14px; }
.pv[data-ms="0"] .pv-seg--act, .pv[data-ms="0"] .pv-seg--view { display: none; }
.pv-abtn { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 56px; height: 48px; padding: 0 6px; border: 0; border-radius: var(--r); background: none; color: var(--ink); font: 500 11.5px/1 var(--fu); text-decoration: none; cursor: pointer; }
.pv-abtn .pv-ic { width: 18px; height: 18px; stroke-width: 1.8; }
.pv-abtn:hover { background: var(--chalk); }
.pv-abtn:disabled, .pv-abtn[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }

/* ---------- 5. Phones and small tablets: under 900px ---------- */
@media (max-width: 899px) {
  .pv-bar { flex-wrap: nowrap; gap: 4px; padding: 6px 6px 6px 8px; }
  .pv-ctls--bar, .pv-sp, .pv-vbar, .pv-phead, .pv-div, .pv-hide, .pv-show { display: none !important; }
  .pv-nsw { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; border: 0; border-radius: var(--r); background: none; color: var(--ink); text-align: left; cursor: pointer; }
  .pv-bk { gap: 6px; margin-left: auto; }
  .pv-bk .pl-bk-btn { width: 44px; min-height: 44px; padding: 0; }
  .pv-bk .pl-bk-btn span { display: none; }
  .pv-act { display: flex; }
  .pv-pages { padding: 12px 8px 20px; }
  .pv-list { display: none; }
  .pv-scrim.is-open { display: block; position: fixed; inset: 0; z-index: 1040; width: 100%; background: rgba(13, 31, 60, 0.4); }
  .pv-list.is-open { display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--psh-top) + 16px); z-index: 1050; width: auto; border-right: 0; border-radius: 12px 12px 0 0; overflow: hidden; box-shadow: 0 -10px 40px rgba(13, 31, 60, 0.18); animation: pv-up 0.22s ease-out; }
  .pv-so { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 12px; border-bottom: 1px solid var(--line); }
  .pv-grab { align-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--line); }
  .pv-soh { display: flex; align-items: center; gap: 10px; }
  .pv-soh strong { flex: 1; font: 600 16px/1.2 var(--fu); }
  .pv-sheet-x { width: 44px; height: 44px; margin-right: -10px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; }
  .pv-sheet-x .pv-ic { width: 18px; height: 18px; stroke-width: 2; }
  .pv-ctls--sheet .pv-sel { flex: 1 1 150px; }
  .pv-ctls--sheet .pv-sel select { width: 100%; height: 44px; font-size: 16px; }
  .pv-ctls--sheet .pv-seg { flex: 1 1 150px; min-width: min-content; }   /* three year ranges are as wide as they are: the switch wraps to its own line instead of clipping one */
  .pv-ctls--sheet .pv-seg > * { flex: 1; min-height: 44px; font-size: 14px; }
  .pv-b { height: 44px; }
}
@keyframes pv-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pv-list.is-open { animation: none; } }
@media (min-width: 900px) {
  .pv-ctls--sheet { display: none; }
}

/* The calculator button (js/photon-calc.js) sits after the booklet buttons. Measured: its word would push the bar onto
   a second row below 1180px, so there it is its icon; between 900 and 1099px even the icon would, so there the calculator
   is the last item of the "All booklets" menu instead (photon-booklet.js). Under 900px every button is an icon. */
@media (max-width: 1179px) {
  .pv-bk .pl-calc-btn span { display: none; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .pv-bar .pv-bk .pl-calc-btn { display: none; }
}

/* ---------- 6. The formula / data booklet viewer (js/photon-booklet.js) ---------- */
.pl-bk-overlay { position: fixed; inset: 0; background: rgba(13, 31, 60, 0.55); z-index: 10001; display: none; align-items: center; justify-content: center; padding: 18px; }
.pl-bk-overlay.open { display: flex; }
.pl-bk-modal { background: #fff; width: min(960px, 96vw); height: 90vh; border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.pl-bk-frame { flex: 1; border: 0; width: 100%; background: #525866; }
.pl-vm-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.pl-vm-head__k { font: 600 10px/1 var(--fu); letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.pl-vm-head__t { font: 400 17px/1.3 var(--fd); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font: 500 13px/1 var(--fu); text-decoration: none; cursor: pointer; }
.pl-btn:hover { background: var(--chalk); }
.pl-bk-menu { position: absolute; z-index: 10002; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 36px rgba(13, 31, 60, 0.22); padding: 6px; font-family: var(--fu); }
.pl-bk-menu__h { font: 600 10.5px/1 var(--fu); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); padding: 8px 10px 6px; }
.pl-bk-menu button { display: flex; width: 100%; min-height: 40px; justify-content: space-between; align-items: center; gap: 14px; background: none; border: 0; border-radius: var(--r); padding: 8px 10px; font: 500 13.5px/1.2 var(--fu); color: var(--ink); cursor: pointer; text-align: left; }
.pl-bk-menu button:hover { background: var(--chalk); }
.pl-bk-menu button em { font-style: normal; font-size: 11.5px; color: var(--mute); }
