/* A question paper or practice set as a web page (utils/webPapers.js), drawn
   in the GYANEXIS question paper design. It sits on top of note-page.css,
   which supplies the site bar, the toolbar and the printed letterhead. */
.is-paper {
  --pq-desk: #e7eaf3;
  --pq-ink: #1b1f33;
  --pq-muted: #5b6178;
  --pq-navy: #1b2a78;
  --pq-gold: #f2b705;
  --pq-line: #d6dbea;
  --pq-tint: #f3f5fb;
  --pq-display: "Montserrat", "Segoe UI", Arial, sans-serif;
  --pq-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}
#note-page.is-paper { background: var(--pq-desk); }

/* ---------- The sheet ---------- */
.is-paper .pq-sheet {
  position: relative; overflow: hidden; background: #fff; color: var(--pq-ink);
  border: 0; border-radius: 2px; padding: 40px clamp(18px, 6vw, 64px) 28px;
  box-shadow: 0 1px 2px rgba(10, 20, 60, .08), 0 18px 40px -12px rgba(10, 20, 60, .25);
  font-family: var(--pq-body); font-size: 15px; line-height: 1.5;
}
.is-paper .pq-sheet::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(70%, 520px); aspect-ratio: 1;
  transform: translate(-50%, -50%); background: url("/assets/images/optimized/logo-trans-512.webp") center / contain no-repeat;
  opacity: .06; pointer-events: none;
}
.is-paper .pq-sheet > * { position: relative; }

/* Letterhead on screen */
.pq-lh { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pq-brand { display: flex; align-items: center; gap: 14px; }
.pq-brand img { width: 64px; height: auto; }
.pq-brand__name { font-family: var(--pq-display); font-weight: 800; font-size: clamp(26px, 4vw, 34px); letter-spacing: .12em; color: var(--pq-navy); line-height: 1; }
.pq-brand p { margin: 6px 0 0; font-family: var(--pq-display); font-weight: 700; font-size: 10.5px; letter-spacing: .28em; color: var(--pq-ink); }
.pq-contact { text-align: right; font-size: 13px; color: var(--pq-muted); line-height: 1.45; }
.pq-rules { margin: 18px 0 0; height: 9px; border-top: 4px solid var(--pq-navy); border-bottom: 2px solid var(--pq-gold); }

/* Paper heading */
.pq-title { text-align: center; margin: 22px 0 14px; }
.pq-eyebrow { font-family: var(--pq-display); font-weight: 700; letter-spacing: .2em; font-size: 12px; color: var(--pq-muted); }
#note-page .pq-title h1 { margin: 6px 0 2px; font-family: var(--pq-display); font-weight: 800; font-size: clamp(20px, 3.2vw, 26px); line-height: 1.25; color: var(--pq-navy); text-wrap: balance; }
.pq-sub { font-weight: 600; }
.pq-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; font-size: 13px; }
.pq-pid { font-variant-numeric: tabular-nums; color: var(--pq-muted); letter-spacing: .06em; }
.pq-subcode { text-align: right; font-weight: 700; }
.pq-roll { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 16px; font-weight: 700; font-size: 13px; }
.pq-boxes { display: flex; }
.pq-boxes i { width: 20px; height: 22px; border: 1px solid var(--pq-ink); border-left: none; }
.pq-boxes i:first-child { border-left: 1px solid var(--pq-ink); }
.pq-facts { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 0; margin-top: 10px; border-top: 1px solid var(--pq-line); border-bottom: 1px solid var(--pq-line); font-weight: 700; }
.pq-facts em { font-style: normal; color: var(--pq-navy); }
.pq-note { margin: 10px 0 0; font-size: 14px; }
.pq-note b { color: var(--pq-navy); }
.pq-note ol { margin: 4px 0 0; padding-left: 20px; }

/* Sections and questions */
.pq-section { margin-top: 26px; }
#note-page .pq-section > h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; font-family: var(--pq-display); font-size: 14px; letter-spacing: .24em; color: var(--pq-navy); break-after: avoid; }
.pq-section > h2::after { content: ""; flex: 1; height: 2px; background: var(--pq-gold); }
.pq-q { margin-top: 14px; }
.pq-qhead { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 6px; font-weight: 700; break-after: avoid; }
.pq-qhead .n { color: var(--pq-navy); margin-right: 6px; font-variant-numeric: tabular-nums; }
.pq-qhead .marks { font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--pq-tint); color: var(--pq-navy); padding: 1px 10px; border-radius: 999px; font-size: 13px; }
.pq-tw { overflow-x: auto; }
.pq-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pq-table th, .pq-table td { border: 1px solid var(--pq-line); padding: 7px 10px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.pq-table th { background: var(--pq-navy); color: #fff; font-family: var(--pq-display); font-weight: 700; font-size: 11.5px; letter-spacing: .1em; border-color: var(--pq-navy); }
.pq-table th:first-child { width: 56px; white-space: nowrap; }
.pq-table th.c, .pq-table td.c { text-align: center; width: 64px; font-variant-numeric: tabular-nums; }
.pq-table td.o { width: 48px; color: var(--pq-navy); font-weight: 700; white-space: nowrap; }
.pq-table tbody tr:nth-child(even) td { background: rgba(27, 42, 120, .035); }
.pq-table td p { margin: 0; }
.pq-table td p + p { margin-top: 6px; }
.pq-table tr { break-inside: avoid; }
.pq-code { margin: 6px 0 0; padding: 8px 10px; background: var(--pq-tint); border-radius: 4px; overflow-x: auto; font: 13px/1.45 Consolas, "Courier New", monospace; white-space: pre; }
.pq-table tr.pq-ans td { background: #f6fbf7; border-top: 0; color: #1f3d2b; }
.pq-table tr.pq-ans b { display: block; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #22603a; margin-bottom: 2px; }
.pq-hide-answers .pq-ans { display: none; }

.pq-foot { margin-top: 36px; padding-top: 10px; border-top: 1px solid var(--pq-gold); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; }
.pq-foot b { color: var(--pq-navy); font-family: var(--pq-display); letter-spacing: .04em; }

/* Toolbar: the answers switch sits opposite the Print button. */
.is-paper .np-toolbar { align-items: stretch; gap: 12px; margin-bottom: 18px; }
.is-paper .np-print { min-height: 44px; justify-content: center; }
.pq-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--np-line); border-radius: 10px; background: #fff; font-weight: 600; font-size: 14px; color: var(--np-dark); cursor: pointer; }
.pq-toggle input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--np-blue); }
.pq-toggle { min-height: 44px; }
.is-paper .np-print:focus-visible,
.pq-toggle:has(input:focus-visible) { outline: 3px solid var(--np-blue); outline-offset: 3px; }

@media screen and (max-width: 420px) {
  .is-paper .np-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .is-paper .np-toolbar > * { width: 100%; margin-left: 0; justify-content: center; }
}

@media screen and (max-width: 520px) {
  .pq-contact, .pq-subcode { text-align: left; }
  .pq-brand p { letter-spacing: .14em; font-size: 9.5px; }
  .is-paper .pq-sheet { padding: 24px 14px 20px; }
  .pq-brand img { width: 48px; }
  .pq-table { font-size: 14px; table-layout: fixed; }
  .pq-table th, .pq-table td { padding: 6px 6px; }
  .pq-table th.c, .pq-table td.c { width: 44px; }
  .pq-table th:first-child { width: 42px; }
  .pq-table th { font-size: 10px; letter-spacing: .02em; padding: 6px 4px; }
  .pq-table td.c { padding: 6px 2px; }
  .pq-table td.o { width: 34px; }
  .pq-boxes i { width: 16px; height: 20px; }
}

/* ================= PRINT ================= */
@media print {
  #note-page.is-paper { background: #fff !important; }
  /* The letterhead printed on every sheet replaces the one drawn on screen,
     and the page footer replaces the sheet's own. */
  .pq-lh, .pq-rules, .pq-foot { display: none !important; }
  /* Transparent and unpositioned, so the letterhead and the watermark behind it show through. */
  .is-paper .pq-sheet { position: static; background: transparent; box-shadow: none; padding: 0; overflow: visible; font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; }
  .is-paper .pq-sheet > * { position: static; }
  .is-paper .pq-sheet::before { display: none; }
  .pq-title { margin-top: 0; }
  #note-page .pq-title h1 { font-size: 16pt; }
  .pq-eyebrow, .pq-section > h2, .pq-table th, .pq-foot b { font-family: Arial, Helvetica, sans-serif; }
  .pq-table { font-size: 10pt; }
  .pq-table th, .pq-table td { padding: 1.4mm 2mm; }
  .pq-tw { overflow: visible; }
  /* A question stays on one sheet when it fits, instead of leaving one row behind. */
  .pq-hide-answers .pq-q, .pq-q:not(:has(tr.pq-ans)) { break-inside: avoid; }
  .pq-code { white-space: pre-wrap; font-size: 9pt; }
}
