/* ============================================================
   myp-glossary.css
   Load after curriculum/dp/glossary/glossary.css, which supplies the
   .gloss colour, the popover and the glossary page layout for both DP and
   MYP. This file adds only what MYP has and DP does not: the Chinese
   translation beside the English, and the language switch.
   ============================================================ */

/* ── language switch ─────────────────────────────────────── */
.gloss-lang-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--gloss);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--gloss);
  cursor: pointer;
}
.gloss-lang-btn[lang="zh-Hans"] { font-family: var(--font-body); font-size: 0.78rem; letter-spacing: 0; }
.gloss-lang-btn:hover, .gloss-lang-btn:focus-visible { background: var(--gloss); color: var(--surface); outline: none; }
.gloss-lang-btn[aria-pressed="true"] { background: var(--gloss); color: var(--surface); }

/* ── popover, Chinese beside English ─────────────────────── */
.myp-gloss-pop.is-zh { width: min(36rem, calc(100vw - 1.5rem)); }
.gloss-pop-term-zh {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gloss);
  margin-top: 0.05rem;
}
.gloss-pop-defs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.3rem;
}
.gloss-pop-defs .gloss-pop-def { margin-top: 0; }
.gloss-pop-def-zh { padding-left: 0.75rem; border-left: 1px solid var(--border); }
.gloss-todo { color: var(--muted); font-style: italic; font-size: 0.8rem; }
.myp-gloss-pop .gloss-pop-foot { align-items: center; }
.myp-gloss-pop .gloss-lang-btn { margin-left: auto; padding: 0.15rem 0.55rem; }
.myp-gloss-pop span.gloss-pop-chip { cursor: default; }
@media (max-width: 560px) {
  .gloss-pop-defs { grid-template-columns: 1fr; }
  .gloss-pop-def-zh { padding-left: 0; border-left: 0; padding-top: 0.5rem; border-top: 1px solid var(--border); }
}

/* ── glossary page ───────────────────────────────────────── */
.gl-search-row .gloss-lang-btn { flex: none; }
.gl-term-zh {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gloss);
  margin-top: 0.1rem;
}
.gl-defs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.gl-defs .gl-def { margin: 0; }
.gl-def-zh { padding-left: 1.25rem; border-left: 1px solid var(--border); }
@media (max-width: 640px) {
  .gl-defs { grid-template-columns: 1fr; gap: 0.6rem; }
  .gl-def-zh { padding-left: 0; border-left: 0; }
}
.gl-source { font-size: 0.72rem; color: var(--muted); margin: 0.35rem 0 0; }

/* With the translation on, each entry needs the full width for two columns. */
html[data-gloss-lang="zh"] .gl-list { grid-template-columns: 1fr; }

/* ── paper and handed-in images ──────────────────────────── */
/* A printout or a downloaded PNG is read without a mouse, so glossary words
   go back to plain text there. body.exporting is set by the worksheet
   scripts while they paint a PNG. */
@media print {
  .gloss { color: inherit !important; background: none !important; text-decoration: none !important; }
  .gloss-pop { display: none !important; }
}
/* No transition, or the painter reads the colour halfway through it. */
body.exporting .gloss { color: inherit !important; background: none !important; text-decoration: none !important; transition: none !important; }
