/* A study note as a web page (utils/webNotes.js). The second half of this
   file is the print layout: the GYANEXIS letterhead on every sheet. */
:root {
  --np-navy: #1b1f7a;
  --np-dark: #0f2b5c;
  --np-blue: #1e73e8;
  --np-gold: #f0b400;
  --np-bg: #fff;
  --np-line: #dbe5f5;
  --np-text: #1a202c;
  --np-muted: #4a5568;
}

#note-page, #note-page * { box-sizing: border-box; }
html { scroll-behavior: smooth; }
#note-page { margin: 0; font-family: 'Inter', Arial, sans-serif; color: var(--np-text); background: var(--np-bg); line-height: 1.65; }
#note-page a { color: var(--np-blue); }

/* ---------- Site bar ---------- */
.np-bar { background: #fff; color: var(--np-dark); border-bottom: 1px solid var(--np-line); }
.np-bar__inner { width: 100%; padding: 6px clamp(12px, 2vw, 28px); display: flex; align-items: center; gap: 12px; }
.np-bar__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
#note-page .np-bar__brand { color: var(--np-dark); }
.np-bar__brand img { width: 24px; height: 24px; }
.np-bar__brand strong { letter-spacing: .06em; font-size: 12px; }
.np-bar__back { margin-left: auto; font-size: 12px; text-decoration: none; }
.np-bar nav { margin-left: auto; display: flex; gap: 18px; font-size: 14px; }
#note-page .np-bar nav a { color: #dbe8ff; text-decoration: none; }
#note-page .np-bar nav a:hover { color: #fff; }

/* ---------- Page ---------- */
.np-page { width: 100%; max-width: none; margin: 0; padding: 12px clamp(12px, 2vw, 28px) 32px; }

.np-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.np-contents { font-size: 14px; }
.np-contents summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--np-line); border-radius: 10px; background: #fff; font-weight: 600; color: var(--np-dark); }
.np-contents summary::-webkit-details-marker { display: none; }
.np-contents summary::after { content: "▾"; font-size: 12px; color: var(--np-muted); }
.np-contents[open] { flex-basis: 100%; order: 2; }
.np-contents[open] summary::after { content: "▴"; }
.np-contents ol { margin: 8px 0 0; padding: 12px 16px 12px 34px; background: #fff; border: 1px solid var(--np-line); border-radius: 10px; }
.np-contents li { margin: 4px 0; }
#note-page .np-contents a { color: var(--np-dark); text-decoration: none; }
#note-page .np-contents a:hover { color: var(--np-blue); }

.np-print { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 10px; background: var(--np-blue); color: #fff; font: 600 14px 'Inter', Arial, sans-serif; cursor: pointer; }
.np-print:hover { background: #1660c7; }
.np-print svg { width: 17px; height: 17px; }


/* ---------- The note ---------- */
.np-sheet { background: #fff; border: 0; border-radius: 0; padding: 20px 0; }
.np-sheet-table, .np-sheet-table > tbody, .np-sheet-table > tbody > tr, .np-sheet-table > tbody > tr > td { display: block; width: 100%; padding: 0; border: 0; }
.np-sheet-table > thead { display: none; }
.np-letterhead, .np-watermark { display: none; }

.np-tag { display: inline-block; background: #e8f1ff; color: var(--np-blue); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.np-body h1 { margin: 12px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--np-line); font-size: clamp(25px, 2.4vw, 36px); line-height: 1.2; color: var(--np-dark); }
.np-body .lead { font-size: 17px; color: #2d3748; }
.np-body h2 { margin: 30px 0 8px; font-size: 22px; color: var(--np-navy); break-after: avoid; scroll-margin-top: 12px; }
.np-body h3 { margin: 20px 0 6px; font-size: 17px; color: var(--np-dark); break-after: avoid; }
.np-body p { margin: 8px 0; }
.np-body { min-width: 0; overflow-wrap: anywhere; }
.np-body code { font-family: Consolas, "Courier New", monospace; font-size: .9em; }
.np-body pre { max-width: 100%; overflow-x: auto; margin: 14px 0; padding: 14px 16px; border: 1px solid var(--np-line); border-radius: 10px; background: #f4f7fc; color: #17304f; white-space: pre; overflow-wrap: normal; tab-size: 4; }
.np-body pre code { font-size: 13px; line-height: 1.65; }
.np-body ul, .np-body ol { padding-left: 22px; }
.np-body li { margin: 4px 0; }

.np-body .box { margin: 14px 0; padding: 12px 16px; border-radius: 10px; break-inside: avoid; }
.np-body .box b:first-child { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.np-body .box.def { background: #eef4ff; border-left: 4px solid var(--np-blue); }
.np-body .box.def b:first-child { color: var(--np-blue); }
.np-body .box.tip { background: #fff8e1; border-left: 4px solid var(--np-gold); }
.np-body .box.tip b:first-child { color: #8a6500; }

.np-body table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14.5px; break-inside: avoid; }
.np-body table.data th { background: var(--np-navy); color: #fff; text-align: left; padding: 9px 12px; }
.np-body table.data td { border: 1px solid var(--np-line); padding: 8px 12px; vertical-align: top; }
.np-body table.data tr:nth-child(even) td { background: #f8fbff; }

.np-body figure { margin: 16px 0; text-align: center; break-inside: avoid; }
.np-body figure svg { max-width: 100%; height: auto; }
.np-body figcaption { font-size: 13px; color: var(--np-muted); margin-top: 4px; }

.np-body .qa { break-inside: avoid; margin: 10px 0; padding: 12px 16px; border: 1px solid var(--np-line); border-radius: 10px; }
.np-body .qa p:first-child { font-weight: 600; margin-top: 0; }
.np-body .qa .ans { color: #22543d; margin-bottom: 0; }

.np-next { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
#note-page .np-next a { text-decoration: none; padding: 9px 14px; border: 1px solid var(--np-line); border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--np-dark); background: #fff; }
#note-page .np-next a:hover { border-color: var(--np-blue); color: var(--np-blue); }

.np-footer { text-align: center; padding: 18px; font-size: 13px; color: var(--np-muted); }

@media screen and (max-width: 720px) {
  /* A wide table scrolls sideways inside itself instead of widening the page. */
  .np-body table.data { display: block; overflow-x: auto; }
  .np-bar nav { display: none; }
  .np-page { padding: 12px 12px 32px; }
  .np-sheet { padding: 16px 0; }
  .np-body h1 { font-size: 25px; }
  .np-body h2 { font-size: 19px; }
  .np-body table.data { font-size: 13.5px; }
  .np-body table.data th, .np-body table.data td { padding: 7px 8px; }
}

/* ================= PRINT: the GYANEXIS letterhead on every sheet ================= */
@page {
  size: A4;
  margin: 12mm 18mm 20mm;
  @bottom-left   { content: "GYANEXIS   \2022   Mind in Motion, Rewards in Hands !"; font: 700 8pt Arial, sans-serif; color: #1b1f7a; border-top: 0.6pt solid #f0b400; padding-top: 2mm; vertical-align: top; }
  @bottom-center { content: ""; border-top: 0.6pt solid #f0b400; }
  @bottom-right  { content: "Page " counter(page) " of " counter(pages); font: 8pt Arial, sans-serif; color: #1a202c; border-top: 0.6pt solid #f0b400; padding-top: 2mm; vertical-align: top; }
}

@media print {
  #note-page, #note-page * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, #note-page { background: #fff !important; }
  #note-page { font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; line-height: 1.5; }

  /* Only the note, the letterhead and the watermark are printed. Everything
     else on the page is left out: the site bar, buttons, links, and any
     advertisement, wherever on the page it was placed. */
  #note-page > *:not(.np-page):not(.np-letterhead):not(.np-watermark) { display: none !important; }
  .np-page > *:not(.np-sheet) { display: none !important; }
  #note-page .gx-ad,
  #note-page .adsbygoogle,
  #note-page .google-auto-placed,
  #note-page ins,
  #note-page iframe,
  #note-page [data-np-no-print] { display: none !important; }

  .np-page { max-width: none; margin: 0; padding: 0; }
  .np-sheet { border: 0; border-radius: 0; padding: 0; background: transparent; }

  /* The table head repeats on every sheet and keeps the letterhead's space free. */
  .np-sheet-table { display: table; width: 100%; border-collapse: collapse; }
  .np-sheet-table > thead { display: table-header-group; }
  .np-sheet-table > tbody { display: table-row-group; }
  .np-sheet-table > tbody > tr { display: table-row; }
  .np-sheet-table > tbody > tr > td { display: table-cell; }
  .np-head-space { height: 31mm; }

  .np-letterhead { display: block; position: fixed; top: 0; left: 0; right: 0; height: 27mm; }
  .np-lh-row { display: flex; align-items: center; gap: 4mm; padding-bottom: 3mm; border-bottom: 1.4pt solid #1b1f7a; }
  .np-lh-row img { width: 15mm; height: 15mm; }
  .np-lh-name { font: 800 21pt Arial, sans-serif; letter-spacing: .09em; color: #1b1f7a; line-height: 1; }
  .np-lh-tag { font: 700 6.5pt Arial, sans-serif; letter-spacing: .28em; color: #111; margin-top: 1.5mm; }
  .np-lh-contact { margin-left: auto; text-align: right; font: 8pt Arial, sans-serif; color: #4a5568; line-height: 1.5; }
  .np-lh-gold { border-top: 0.8pt solid #f0b400; margin-top: 0.8mm; }
  .np-lh-date { text-align: right; font: 8.5pt Arial, sans-serif; margin-top: 2mm; }
  .np-lh-date b { color: #1b1f7a; }

  .np-watermark { display: block; position: fixed; top: 50%; left: 50%; width: 120mm; height: 120mm; margin: -60mm 0 0 -60mm; opacity: .07; z-index: -1; }

  .np-body h1 { font-size: 20pt; margin-top: 2mm; }
  .np-body h2 { font-size: 14pt; margin-top: 6mm; }
  .np-body h3 { font-size: 11.5pt; }
  .np-body .lead { font-size: 11pt; }
  .np-tag { border: 0.6pt solid #1e73e8; }
  #note-page .np-body a { color: inherit; text-decoration: none; }
  .np-body p, .np-body li { orphans: 3; widows: 3; }
}

/* Compact reader navigation: current module belongs on the right. */
.np-bar { position: sticky; top: 0; z-index: 20; }
.np-body h2, .np-body h3 { scroll-margin-top: 76px; }
.np-bar__inner { min-height: 48px; gap: 16px; }
.np-bar__brand { flex: 0 0 auto; }
.np-bar__context { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; color: var(--np-dark); text-align: right; font-size: 12px; line-height: 1.4; }
.np-bar__context span { overflow-wrap: anywhere; }
.np-bar__context strong { flex-shrink: 0; padding: 4px 9px; border-radius: 7px; color: #fff; background: #1763d5; }
.np-contents summary { color: #fff; background: #1763d5; border-color: #1763d5; }
.np-contents summary::after { color: #fff; }
.np-contents summary:hover, .np-print:hover { background: #124fae; }
.np-print { background: #1763d5; }
.np-print-tag { display: none; }
.np-bar a:focus-visible, .np-print:focus-visible, .np-contents summary:focus-visible { outline: 3px solid #79aeff; outline-offset: 3px; }
@media (max-width: 480px) {
  .np-bar__inner { gap: 8px; padding-block: 8px; }
  .np-bar__brand { gap: 5px; }
  .np-bar__brand strong { font-size: 10px; }
  .np-bar__context { gap: 6px; font-size: 11px; }
  .np-bar__context strong { padding: 3px 6px; }
  .np-toolbar { gap: 8px; }
  .np-print, .np-contents summary { font-size: 12px; padding: 9px 10px; }
}
@media print {
  .np-print-tag { display: inline-block; }
  .np-body pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; border-color: #bbb; }
}
