/* ============================================
   Novus Ignis · słownik pojęć i podpowiedzi (js/gloss.js)
   Strona słownika (.glossary) oraz pojęcia podkreślone kropkami w tekście (.gloss) z dymkiem (.gloss-pop).
   Bez JavaScriptu .gloss to zwykły odnośnik do strony słownika.
   ============================================ */

/* Pojęcie w tekście: ten sam kolor co otoczenie, podkreślenie kropkami */
a.gloss, .doc a.gloss, .doc a.gloss:hover {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: rgba(255, 178, 122, 0.85);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  cursor: help;
}
a.gloss:hover, .doc a.gloss:hover { text-decoration-style: solid; text-decoration-color: var(--ni-flame-light, #FFB27A); }
a.gloss:focus-visible { outline: 2px solid var(--ni-flame-light, #FFB27A); outline-offset: 2px; border-radius: 3px; }
a.gloss[aria-expanded="true"] { background: rgba(255, 178, 122, 0.14); border-radius: 3px; }

/* Dymek */
.gloss-pop {
  position: absolute; z-index: 300; box-sizing: border-box;
  width: min(23rem, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
  padding: 12px 14px 12px; background: #16161f; color: #E4E4EC;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  font-family: var(--font-body, system-ui, sans-serif); font-size: 0.94rem; line-height: 1.55; text-align: left;
}
.gloss-pop[hidden] { display: none; }
.gloss-pop:focus { outline: none; }
.gloss-pop:focus-visible { outline: 2px solid var(--ni-flame-light, #FFB27A); outline-offset: 2px; }
.gloss-pop__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gloss-pop__title { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--font-display, inherit); font-size: 1.05rem; font-weight: 700; line-height: 1.3; color: #fff; overflow-wrap: anywhere; }
.gloss-pop__title:focus { outline: none; }
.gloss-pop__btn {
  flex: 0 0 auto; min-height: 32px; min-width: 32px; padding: 4px 10px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, 0.08); color: #E4E4EC; font: inherit; font-size: 0.86rem; line-height: 1.2; cursor: pointer;
}
.gloss-pop__btn:hover { background: rgba(255, 255, 255, 0.16); }
.gloss-pop__btn[hidden] { display: none; }
.gloss-pop__close { font-size: 1.2rem; line-height: 1; padding: 2px 8px; }
.gloss-pop__def { margin: 0; }
.gloss-pop__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin: 10px 0 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.84rem; color: #B9B9C9; }
.gloss-pop a:not(.gloss) { color: #FFB27A; text-decoration: underline; text-decoration-color: rgba(255, 178, 122, 0.45); text-underline-offset: 2px; }
.gloss-pop a:not(.gloss):hover { color: #FFD3B0; text-decoration-color: currentColor; }
.gloss-pop a:focus-visible, .gloss-pop button:focus-visible { outline: 2px solid var(--ni-flame-light, #FFB27A); outline-offset: 2px; }

/* Telefon: panel przy dolnej krawędzi ekranu */
@media (max-width: 640px) {
  .gloss-pop {
    position: fixed !important; left: 8px !important; right: 8px !important; top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto; max-height: min(62vh, 26rem); font-size: 1rem;
  }
  .gloss-pop__btn { min-height: 40px; min-width: 40px; }
}

/* Ruch tylko wtedy, gdy czytelnik go nie wyłączył */
@media (prefers-reduced-motion: no-preference) {
  .gloss-pop:not([hidden]) { animation: gloss-in 0.14s ease-out; }
  @keyframes gloss-in { from { opacity: 0; } to { opacity: 1; } }
}
@media (forced-colors: active) {
  .gloss-pop { border-color: CanvasText; }
}
@media print {
  .gloss-pop { display: none !important; }
  a.gloss, .doc a.gloss { text-decoration: none; }
}

/* Strona „Słownik” */
.glossary { margin: 0; }
.doc .glossary { margin-top: 1.4em; }
.glossary-entry { padding: 0.9em 0.6em 1em; margin: 0 -0.6em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); scroll-margin-top: 90px; }
.glossary-entry dt { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: #fff; line-height: 1.3; }
.glossary-entry dd { margin: 0.35em 0 0; }
.glossary-entry dd.glossary-src { font-size: 0.88rem; color: var(--ni-text-muted); margin-top: 0.5em; }

/* Nazwa łacińska przy haśle słownika (wspólna dla wszystkich języków) */
.glossary-latin { font-style: italic; font-weight: 400; color: #00D2FF; margin-left: 0.4em; }
