/* qamar-common common.css — the shared primary header and content footer of muftiqamar.com and
   maktaba.muftiqamar.com. Owned by the dars repo; vendored (pinned + hash-checked) by both sites. See README.md.

   No palette and no @font-face of its own: every colour, radius, space and font is read from the tokens both sites
   define (--bg-2 --bg-3 --fg --fg-2 --accent --accent-2 --on-accent --border --radius-s --radius-pill --space-1..5
   --font-ur --font-en), through --qc-* aliases a site may override. Dark mode comes from the site's own tokens
   (header.js forces light/dark by rewriting the prefers-color-scheme media rules). Every selector is .qc-*. */

.qc-header, .qc-footer {
  --qc-bar: var(--bg-3, #f3f4ef);
  --qc-surface: var(--bg-2, #fff);
  --qc-fg: var(--fg, #1b211e);
  --qc-fg-2: var(--fg-2, #565c57);
  --qc-accent: var(--accent, #0d6647);
  --qc-accent-2: var(--accent-2, #0a4732);
  --qc-on-accent: var(--on-accent, #fff);
  --qc-border: var(--border, #e2e4dc);
  --qc-r-s: var(--radius-s, 6px);
  --qc-r-pill: var(--radius-pill, 999px);
  --qc-s1: var(--space-1, 4px); --qc-s2: var(--space-2, 8px); --qc-s3: var(--space-3, 12px);
  --qc-s4: var(--space-4, 16px); --qc-s5: var(--space-5, 24px);
  --qc-font-ur: var(--font-ur, 'Noto Nastaliq Urdu', serif);
  --qc-font-en: var(--font-en, Georgia, serif);
  --qc-fs-ur: var(--fs-ur-small, 17px);   /* 1.4.3: Urdu nav labels and footer text */
  --qc-tap: var(--ctl-h, 44px);          /* 1.4.3: minimum touch target */
  /* Library gold (tokens.css; the only non-green accent, Library item only) */
  --qc-gold: var(--library-gold, #7a5200);
  --qc-gold-bg: var(--library-gold-bg, #f8edc8);
  --qc-gold-ring: var(--library-gold-ring, #c9a23c);
  --qc-gold-glow: var(--library-gold-glow, rgba(201, 162, 60, 0.4));
  --qc-gold-sel: var(--library-gold-sel, #ffe27a);
  --qc-gold-on-sel: var(--library-gold-on-sel, #5c3d00);
  --qc-gold-sel-ring: var(--library-gold-sel-ring, #f0b400);
  --qc-gold-sel-glow: var(--library-gold-sel-glow, rgba(255, 196, 0, 0.65));
  box-sizing: border-box;
}
.qc-header *, .qc-footer * { box-sizing: border-box; }

/* ─── Header: one row, RTL (Home rightmost), the scheme toggle at the left end. Not sticky. ─── */
.qc-header {
  position: relative; z-index: 40;
  display: flex; align-items: center; gap: var(--qc-s2);
  padding-inline-end: var(--qc-s3);
  background: var(--qc-bar); border-bottom: 1px solid var(--qc-border);
  font-family: var(--qc-font-en); line-height: 1.6;
}
.qc-nav {
  flex: 1 1 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 2px var(--qc-s2);
  padding: var(--qc-s1) var(--qc-s4);
}
.qc-nav-item {
  display: inline-flex; align-items: baseline; gap: var(--qc-s2);
  padding: 2px var(--qc-s3); border-radius: var(--qc-r-pill);
  color: var(--qc-accent-2); text-decoration: none;
  font-family: var(--qc-font-en); font-size: 14px; font-weight: 600; line-height: 2;
  border: 1px solid transparent;
}
.qc-nav-item .qc-ur { font-family: var(--qc-font-ur); font-weight: 400; font-size: var(--qc-fs-ur); line-height: 2; }
.qc-nav-item .qc-en { font-family: var(--qc-font-en); }
.qc-nav-item:hover { border-color: var(--qc-accent); }
.qc-nav-item[aria-current="page"] { background: var(--qc-accent); color: var(--qc-on-accent); }
.qc-nav-item:focus-visible { outline: 2px solid var(--qc-accent); outline-offset: 2px; }
.qc-search { gap: 6px; }
.qc-icon { width: 14px; height: 14px; align-self: center; flex: 0 0 auto; }
/* Library (مکتبہ): the last item, its own site; GOLD, the single exception to the green palette (README). */
.qc-library {
  color: var(--qc-gold); background: var(--qc-gold-bg);
  box-shadow: inset 0 0 0 1px var(--qc-gold-ring), 0 0 10px var(--qc-gold-glow);
}
.qc-library:hover { border-color: var(--qc-gold); box-shadow: inset 0 0 0 1px var(--qc-gold-ring), 0 0 14px var(--qc-gold-glow); }
.qc-library:focus-visible { outline: 2px solid var(--qc-gold); outline-offset: 2px; }
.qc-library:active, .qc-library[aria-current="page"] {
  background: var(--qc-gold-sel); color: var(--qc-gold-on-sel); border-color: var(--qc-gold-sel-ring);
  box-shadow: inset 0 0 0 1px var(--qc-gold-sel-ring), 0 0 6px var(--qc-gold-sel-glow), 0 0 20px var(--qc-gold-sel-glow);
}
.qc-library[aria-current="page"]:focus-visible { outline-color: var(--qc-gold); }

/* ─── Tools at the left end (1.6.0): the text-size control and the colour-scheme toggle ─── */
.qc-tools { flex: 0 0 auto; display: flex; align-items: center; gap: var(--qc-s2); }
.qc-scheme-toggle, .qc-ts-open, .qc-ts-btn {
  flex: 0 0 auto; min-width: 32px; height: 32px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--qc-s1);
  font: 600 16px/1 var(--qc-font-en); cursor: pointer;
  color: var(--qc-accent-2); background: var(--qc-surface);
  border: 1px solid var(--qc-border); border-radius: var(--qc-r-pill);
}
.qc-scheme-toggle:hover, .qc-ts-open:hover, .qc-ts-btn:hover { border-color: var(--qc-accent); color: var(--qc-accent); }
.qc-scheme-toggle:focus-visible, .qc-ts-open:focus-visible, .qc-ts-btn:focus-visible { outline: 2px solid var(--qc-accent); outline-offset: 2px; }
/* the colour button: icon + a visible «رنگ» on wide screens (1.6.0); title / aria-label are Urdu first */
.qc-scheme-icon { display: inline-block; width: 1em; text-align: center; }
.qc-scheme-label { display: none; font-family: var(--qc-font-ur); font-weight: 400; font-size: var(--qc-fs-ur); line-height: 1; padding-bottom: 0.15em; }
@media (min-width: 1000px) {
  .qc-scheme-toggle { width: 76px; padding-inline: 8px; }
  .qc-scheme-label { display: inline; }
}
/* Text size A− · A · A+ (1.6.0). Shown only once <html data-qc-text> is set (head-early.html, before first paint, or
   header.js), so without scripts the control is absent and nothing shifts when it appears. Wide screens: the three
   steps inline. <= 720 px: one «Aa» button opens them as a small panel below the header. */
.qc-textsize { display: none; position: relative; align-items: center; }
html[data-qc-text] .qc-textsize { display: flex; }
.qc-ts-open { display: none; font-size: 15px; }
.qc-ts-steps { display: flex; align-items: center; gap: 2px; direction: ltr; }
.qc-ts-btn { width: 36px; font-size: 14px; letter-spacing: 0.02em; }  /* fixed widths: a late font never moves the nav */
.qc-ts-btn[data-qc-text-step="+1"] { font-size: 17px; }
.qc-ts-btn[data-qc-text-step="-1"] { font-size: 13px; }
.qc-ts-btn[aria-disabled="true"] { opacity: 0.45; cursor: default; border-color: var(--qc-border); color: var(--qc-accent-2); }
.qc-vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Guest mode (1.6.0): a site that is a guest of this header (maktaba: render.header(guest=True), the default there)
   drops the items whose meaning belongs to the host site (dars's lecture topics and lecture search), so its own
   bar's Topics / Search are the only ones on the page. */
.qc-header.qc-guest .qc-home-only { display: none; }

@media (max-width: 720px) {
  /* Phones: stacked bilingual labels (Urdu over English). 1.6.0: Urdu 17 px (the floor; was 16), English 12 px,
     items at least 44 px; when the items do not fit one row they wrap into two full rows, 4 + 3 at 360-430 px (RTL
     order, Home first at the right; flex-basis 22% keeps a row to at most 4, and >= 44 px wide; each row's items share
     its width), so Search and Library are always visible. English labels stay at every width (1.6.0; they were
     hidden at <= 360 px): at <= 380 px they shrink to 11 px, at <= 340 px a long one may wrap onto a second line. */
  .qc-header { padding-inline-end: var(--qc-s1); gap: 2px; }
  .qc-nav { min-width: 0; padding: 4px 2px; gap: 2px 0; justify-content: center; flex-wrap: wrap; }
  .qc-nav-item { flex: 1 0 22%; min-width: min-content; min-height: var(--qc-tap); flex-direction: column; align-items: center;
    justify-content: center; gap: 0; padding: 2px 4px; line-height: 1.2; border-radius: var(--qc-r-s); text-align: center; }
  .qc-nav-item .qc-ur { font-size: var(--qc-fs-ur); line-height: 1.8; white-space: nowrap; }
  .qc-nav-item .qc-en { font-size: 12px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
  .qc-header.qc-guest .qc-nav-item { flex-basis: 30%; }  /* guest: five items, 3 + 2 */
  .qc-search .qc-icon { display: none; }
  .qc-tools { flex-direction: column; gap: 2px; }
  .qc-scheme-toggle, .qc-ts-open { width: 36px; height: 36px; font-size: 15px; }
  .qc-ts-btn { width: var(--qc-tap); height: var(--qc-tap); }
}
/* The «Aa» panel (1.6.0): on phones, and on touch tablets below 1000 px, where the three inline steps (~190 px with
   the colour button) would push the nav into a third row, one «Aa» button opens the steps below the header. */
@media (max-width: 720px), (max-width: 999px) and (pointer: coarse) {
  .qc-ts-open { display: inline-flex; }
  .qc-textsize { position: static; }
  .qc-ts-steps { display: none; position: absolute; z-index: 60; top: calc(100% + 4px); left: var(--qc-s1);  /* physical: the tools sit at the left end */
    padding: var(--qc-s2); gap: var(--qc-s2); background: var(--qc-surface); border: 1px solid var(--qc-border);
    border-radius: var(--qc-r-s); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
  .qc-textsize.qc-open .qc-ts-steps { display: flex; }
  .qc-ts-open[aria-expanded="true"] { background: var(--qc-accent); color: var(--qc-on-accent); border-color: var(--qc-accent); }
}
@media (max-width: 380px) {
  .qc-nav-item { padding-inline: 2px; }
  .qc-nav-item .qc-en { font-size: 11px; letter-spacing: 0; }
}
@media (max-width: 340px) { .qc-nav-item .qc-en { white-space: normal; line-height: 1.15; } }
@media (pointer: coarse) {
  /* 1.4.3: touch targets */
  .qc-nav-item { min-height: var(--qc-tap); align-items: center; }
  .qc-scheme-toggle, .qc-ts-open, .qc-ts-btn { min-width: var(--qc-tap); height: var(--qc-tap); }
  .qc-ts-btn { width: var(--qc-tap); }
  .qc-ts-steps { gap: var(--qc-s1); }
  .qc-footer-links a { display: inline-flex; align-items: center; min-height: var(--qc-tap); padding-inline: var(--qc-s1); }
}

/* ─── Footer (content pages only): disclaimer (Urdu right-aligned, English left-aligned) + Home · Library · Privacy ─── */
.qc-footer {
  margin-top: auto;
  color: var(--qc-fg-2); background: var(--qc-bar);
  border-top: 1px solid var(--qc-border);
  padding: var(--qc-s5) 16px;
  font-family: var(--qc-font-en); font-size: 14px; line-height: 1.6;
}
.qc-footer-notes { max-width: 720px; margin: 0 auto var(--qc-s3); }
.qc-footer-note { margin: 0 0 var(--qc-s2); }
.qc-footer-note[lang="ur"] { font-family: var(--qc-font-ur); font-size: var(--qc-fs-ur); line-height: 2.1; text-align: right; }
.qc-footer-note[lang="en"] { text-align: left; }
.qc-footer a { color: var(--qc-accent-2); }
.qc-mail { font-family: var(--qc-font-en); unicode-bidi: isolate; }
.qc-footer-links {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: var(--qc-s1) var(--qc-s3);
}
.qc-footer-links a { text-decoration: none; font-size: 13px; }
.qc-footer-links a [lang="ur"] { font-family: var(--qc-font-ur); font-size: var(--qc-fs-ur); }
.qc-footer-links a [lang="en"] { font-family: var(--qc-font-en); }
.qc-footer-links a:hover { text-decoration: underline; }
.qc-sep { opacity: 0.6; }

/* Slim footer (1.6.0, footer-slim.html): utility pages (about, privacy, search form): feedback line + links only. */
.qc-footer-slim { padding: var(--qc-s4) 16px; }
.qc-footer-slim .qc-footer-note { max-width: 720px; margin: 0 auto var(--qc-s2); }

/* Print (1.6.0): the header and the footer's screen parts are not printed; in their place one black citation line
   (site · page title — address), so a printed sheet says where it came from. A page with its own fuller citation (the
   library reader) hides the whole footer in its print CSS. */
.qc-print-cite { display: none; }
@media print {
  .qc-header { display: none !important; }
  .qc-footer { display: block !important; margin: 12pt 0 0; padding: 4pt 0 0; background: none; border: 0;
    border-top: 1px solid #000; color: #000; }
  .qc-footer > :not(.qc-print-cite) { display: none !important; }
  .qc-print-cite { display: block; margin: 0; font: 10pt/1.9 var(--qc-font-en); color: #000; text-align: right; }
  .qc-print-cite [lang="ur"] { font-family: var(--qc-font-ur); }
  /* the page title's face follows its language (cite_lang): Nastaliq, Amiri (never bold), Source Serif; a title with
     no lang (an overridden runtime title) uses Source Serif for Latin and falls through to Nastaliq for Urdu */
  .qc-print-cite bdi:first-of-type { font-family: 'Source Serif 4', 'Noto Nastaliq Urdu', var(--qc-font-ur); }
  .qc-print-cite bdi[lang="ur"] { font-family: var(--qc-font-ur); }
  .qc-print-cite bdi[lang="ar"] { font-family: var(--font-ar, 'Amiri', serif); font-weight: 400; }
  .qc-print-cite bdi[lang="en"] { font-family: var(--qc-font-en); }
}
