/* IAL Prep — the formula sheet panel beside the questions (js/formulae.js), its button on the bank's
   bottom bar, and the formula sheet line on the past papers page. In the site's Control look
   (css/control.css): hairline borders, squared corners, plain sentence-case names. */

/* ---------- The button on the bottom bar ---------- */
.topicbank .tb-fx-btn { gap: 9px; min-height: 42px; padding: 8px 14px 7px 12px; }
.topicbank .tb-fx-btn[hidden] { display: none; }
.topicbank .tb-fx-btn svg { width: 18px; height: 18px; stroke-width: 1.7; }
.topicbank .tb-fx-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.topicbank .tb-fx-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
@media (max-width: 520px) {
  .topicbank .tb-fx-btn .tb-fx-t { display: none; }
  .topicbank .tb-fx-btn { padding-left: 11px; padding-right: 11px; }
}

/* ---------- The button on the whiteboard's bar (js/board.js) ----------
   Whiteboard mode hides the bottom bar, so the sheet gets a button beside Exit whiteboard, drawn like it. */
.topicbank .wb-fx {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--ink-b);
  padding: 0 14px 0 10px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  font: 700 14px/1 var(--f-display);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.topicbank .wb-fx[hidden] { display: none; }
.topicbank .wb-fx svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topicbank .wb-fx:hover { border-color: var(--ink); background: var(--field); }
.topicbank .wb-fx[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.topicbank .wb-fx:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .topicbank .wb-fx { justify-content: center; width: var(--ink-b); padding: 0; }
  .topicbank .wb-fx-t { display: none; }
}
/* The panel ends above the whiteboard's bar, which takes the bottom bar's place. */
.topicbank.tb-board .fx { bottom: var(--wb-h, 57px); }

/* ---------- The panel ----------
   A tablet or phone: over the questions from the right edge, above the bottom bar. A wide screen
   (1200px and up): docked, and the questions move over to make room (body.fx-docked). */
.fx {
  --fx-w: min(480px, 92vw);
  position: fixed;
  z-index: 36;
  top: var(--site-nav-h, 58px);
  right: 0;
  bottom: var(--dl-h, 64px);
  display: flex;
  flex-direction: column;
  width: var(--fx-w);
  border-left: 1px solid var(--line-2);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 0.34s var(--ease);
}
.fx[hidden] { display: none; }
.fx.is-in { transform: none; }
@media (min-width: 1200px) {
  .fx { --fx-w: clamp(400px, 34vw, 600px); box-shadow: none; }
  .topicbank.fx-docked { --fx-dock: clamp(400px, 34vw, 600px); }
  /* The questions keep clear of it; the filters become their sheet, as when a mark scheme is open beside a question. */
  .topicbank.fx-docked .tb-main { max-width: calc(1480px + var(--fx-dock)); padding-right: calc(var(--fx-dock) + 28px); }
  .topicbank.fx-docked .tb-edge-r,
  .topicbank.fx-docked .tb-tab-r { right: var(--fx-dock); }
  .topicbank.fx-docked .ctl-top { right: calc(var(--fx-dock) + 18px); }
  .topicbank.fx-docked .ctl-toasts { right: calc(var(--fx-dock) + 18px); }
  /* Whiteboard mode: the sheet floats over the page, so the cards (and the writing on them) keep
     their size (js/formulae.js layout). Back to top and the notifications step out from under it. */
  .topicbank.tb-focus .fx { box-shadow: var(--shadow); }
  .topicbank.tb-focus.fx-open .ctl-top { right: clamp(400px, 34vw, 600px); }
  .topicbank.tb-focus.fx-open .ctl-toasts { right: calc(clamp(400px, 34vw, 600px) + 18px); }
}
@media (prefers-reduced-motion: reduce) { .fx { transition-duration: 0.01s; } }

.fx-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.fx-head .ctl-label { flex: 1; min-width: 0; margin: 0; }
.fx-zoom { display: inline-flex; align-items: center; border: 1px solid var(--line-2); }
.fx-z,
.fx-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.fx-z svg,
.fx-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.fx-close { width: 44px; height: 44px; margin-right: -4px; }
.fx-close svg { width: 20px; height: 20px; }
.fx-z:hover:not(:disabled),
.fx-close:hover { color: var(--accent); }
.fx-z:disabled { opacity: 0.35; cursor: default; }
.fx-z:focus-visible,
.fx-close:focus-visible,
.fx-unit:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.fx-z-v { min-width: 3.4em; color: var(--ink-2); font: 700 12px/1 var(--f-display); text-align: center; font-variant-numeric: tabular-nums; }

/* The subject's units, as small squared tags; the one shown is filled. */
.fx-units { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 18px 0; }
.fx-units[hidden] { display: none; }
.fx-unit {
  min-width: 38px;
  min-height: 32px;
  padding: 5px 9px 4px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font: 600 13px/1.2 var(--f-display);
  cursor: pointer;
}
.fx-unit:hover { border-color: var(--accent); color: var(--ink); }
.fx-unit[aria-pressed="true"] { border-color: var(--tab-on); background: var(--tab-on); color: var(--tab-on-ink); }

.fx-what { padding: 12px 18px 12px; border-bottom: 1px solid var(--line); }
.fx-what p { margin: 0; }
.fx-t { color: var(--ink); font-size: 15px; line-height: 1.35; }
.fx-t b { font: 700 15px/1.35 var(--f-display); }
.fx-code { margin-right: 4px; color: var(--accent); font: 700 13px/1 var(--f-display); }
.fx-about { margin-top: 4px !important; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.fx-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px !important; }
.fx-pdf { gap: 8px; min-height: 38px; padding: 7px 12px 6px; font-size: 14px; }
.fx-pdf small { color: var(--ink-2); font-size: 12px; font-weight: 400; }
.fx-whole { color: var(--ink); font-size: 14px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.fx-whole:hover { color: var(--accent); text-decoration-color: currentColor; }

/* The pages: white paper on the dark panel, every page at the same print size. At a larger size the
   column scrolls sideways as well as down. */
.fx-pages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 22px;
}
.fx-pages:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.fx-page {
  display: block;
  width: calc(100% * var(--fx-pw, 1) * var(--fx-zoom, 1));
  max-width: none;
  height: auto;
  margin: 0 0 10px;
  background: #fff;
}
.fx:not(.is-zoomed) .fx-page { max-width: 100%; }
.fx-also {
  margin: 18px 4px 10px;
  color: var(--ink);
  font: 700 14px/1.35 var(--f-display);
}

@media (pointer: coarse) {
  .fx-z { width: 44px; height: 42px; }
  .fx-unit { min-height: 40px; min-width: 44px; }
}
@media (max-width: 520px) {
  .fx-head { padding-left: 14px; }
  .fx-units, .fx-what { padding-left: 14px; padding-right: 14px; }
  .fx-pages { padding: 10px 8px 18px; }
}

/* ---------- Past papers page: the chosen unit's sheet under the filters ---------- */
.pp-sheet { display: grid; gap: 6px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.pp-sheet[hidden] { display: none; }
.pp-sheet-t { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.pp-sheet .ctl-btn { justify-self: start; gap: 8px; min-height: 40px; }
.pp-sheet .ctl-btn small { color: var(--ink-2); font-size: 12px; font-weight: 400; }
