/* NEXUS glossary: the term bubble used inside the articles (glossary-tip.js) and the dictionary page (diccionario.html / en/glossary.html).
   Dictionary links are dotted and sage; citation links stay underlined with a [n] marker, so the two never look alike. */

/* ---------- term inside an article ---------- */
.gl-term {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: #a9c4b5;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 5px;
  color: color-mix(in srgb, #bcd6c7 38%, currentColor);
  background: rgba(143, 168, 154, .12);
  box-shadow: 0 0 0 3px rgba(143, 168, 154, .12);   /* a soft halo so the word reads as something to tap, even before hovering */
  border-radius: 4px;
  transition: background .25s ease, box-shadow .25s ease, text-decoration-color .25s ease;
}
.gl-term:hover, .gl-term:focus-visible, .gl-term.is-open { background: rgba(143, 168, 154, .28); box-shadow: 0 0 0 3px rgba(143, 168, 154, .28); text-decoration-color: #d3e8dc; }
.gl-term:focus-visible { outline: 2px solid var(--accent-2, #8fa89a); outline-offset: 2px; }

/* ---------- the bubble ---------- */
.gl-bubble {
  position: absolute; z-index: 2000; width: min(340px, calc(100vw - 24px));
  padding: 16px 18px 14px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface-2, #1c1b18); color: var(--text); box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.gl-bubble.is-on { opacity: 1; transform: none; pointer-events: auto; }
.gl-bubble[hidden] { display: none; }
.gl-bubble-k { margin: 0 0 6px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--accent-2, #8fa89a); }
.gl-bubble-t { margin: 0 24px 8px 0; font-family: var(--font-display); font-weight: 500; font-size: 1.12rem; line-height: 1.25; color: var(--text); }
.gl-bubble-d { margin: 0 0 12px; font-size: .9rem; line-height: 1.6; color: var(--text-dim); }
.gl-bubble-go { display: inline-block; color: var(--accent); font-size: .82rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.gl-bubble-go:hover { border-bottom-color: var(--accent); }
.gl-bubble-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-faint); font-size: 20px; line-height: 1; cursor: pointer; }
.gl-bubble-x:hover { color: var(--text); background: rgba(243, 238, 227, .08); }
.gl-backdrop { position: fixed; inset: 0; z-index: 1999; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .2s ease; }
.gl-backdrop.is-on { opacity: 1; }
.gl-backdrop[hidden] { display: none; }
@media (max-width: 640px) {
  /* on phones the bubble becomes a sheet at the bottom of the screen */
  .gl-bubble { position: fixed; left: 0; right: 0; bottom: 0; top: auto !important; width: auto; max-height: 70vh; overflow: auto; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 20px 22px calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateY(14px); }
  .gl-bubble.is-on { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gl-bubble, .gl-backdrop { transition: none; } }

/* ---------- dictionary page ---------- */
.gl-hero { padding: clamp(120px, 14vw, 170px) 0 28px; position: relative; }
.gl-hero .ambient-glow { opacity: .55; }
.gl-kicker { margin: 0 0 14px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.gl-title { margin: 0 0 16px; font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; }
.gl-sub { margin: 0; max-width: 560px; color: var(--text-dim); font-size: 1.02rem; line-height: 1.6; font-weight: 300; }
.gl-wrap { max-width: 860px; margin: 0 auto; padding: 0 var(--pad) 100px; }

.gl-bar { display: flex; align-items: center; gap: 18px; margin: 14px 0 22px; }
.gl-bar .lib-search { flex: 1; margin: 0; }
.gl-count { flex: none; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

.gl-az { display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 14px 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.gl-az a, .gl-az span { min-width: 26px; height: 26px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 12.5px; font-weight: 600; text-decoration: none; color: var(--text); transition: background .2s ease, color .2s ease; }
.gl-az a:hover { background: var(--accent-soft); color: var(--accent); }
.gl-az a.is-active { background: var(--accent); color: var(--bg); }
.gl-az a.is-empty { color: var(--text-faint); font-weight: 400; }   /* letters with no terms yet: still there, quieter */
.gl-az span, .gl-az a.is-none { color: var(--text-faint); opacity: .35; pointer-events: none; font-weight: 400; }

.gl-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.gl-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--text-dim); font: 500 12.5px var(--font-body); cursor: pointer; transition: border-color .25s var(--ease), color .25s var(--ease), background .25s var(--ease); }
.gl-pill:hover { color: var(--text); border-color: var(--text-faint); }
.gl-pill.is-active { color: var(--bg); border-color: var(--accent); background: var(--accent); }
.gl-pill .n { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .75; }
.gl-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gl-view[hidden] { display: none; }
html[lang="en"] .gl-view[data-lang="es"], html:not([lang="en"]) .gl-view[data-lang="en"] { display: none; }

.gl-sec { padding: 0; margin-bottom: 30px; scroll-margin-top: 110px; } /* it is a <section>: cancel the page-wide section padding */
.gl-sec[hidden] { display: none; }
.gl-letter { margin: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); font-family: var(--font-display); font-weight: 500; font-size: 1.7rem; line-height: 1; color: var(--accent); }
.gl-row { border-bottom: 1px solid var(--line); scroll-margin-top: 110px; }
.gl-row[hidden] { display: none; }
.gl-head { width: 100%; display: grid; grid-template-columns: minmax(150px, .85fr) minmax(0, 1.7fr) 20px; align-items: center; gap: 8px 28px; padding: 17px 2px; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.gl-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.gl-name { font-weight: 600; font-size: .96rem; line-height: 1.35; }
.gl-short { color: var(--text-dim); font-size: .88rem; line-height: 1.5; font-weight: 300; }
.gl-chev { justify-self: center; width: 8px; height: 8px; margin-top: -4px; border: solid var(--text-faint); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); transition: transform .3s var(--ease), border-color .2s ease, margin .3s var(--ease); }
.gl-head:hover .gl-chev { border-color: var(--text); }
.gl-row.is-open .gl-chev { transform: rotate(225deg); margin-top: 4px; border-color: var(--accent); }
.gl-row.is-open .gl-name { color: var(--accent); }
.gl-body { padding: 2px 2px 22px; max-width: 640px; }
.gl-body[hidden] { display: none; }
.gl-def { margin: 0 0 14px; font-size: .95rem; line-height: 1.7; color: var(--text); }
.gl-xref { color: var(--accent); text-decoration: underline dotted; text-decoration-color: var(--accent-2, #8fa89a); text-underline-offset: 4px; }
.gl-ex { margin: 0 0 14px; padding: 12px 16px; border-left: 2px solid var(--accent-2, #8fa89a); background: rgba(243, 238, 227, .03); border-radius: 0 10px 10px 0; font-size: .9rem; line-height: 1.65; color: var(--text-dim); }
.gl-ex b { display: block; margin-bottom: 3px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--accent-2, #8fa89a); }
.gl-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: .82rem; color: var(--text-faint); }
.gl-meta a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.gl-meta a:hover { border-bottom-color: var(--accent); }
.gl-chip { padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 11px; letter-spacing: .04em; color: var(--text-dim); }
.gl-empty { padding: 14px 0 40px; color: var(--text-faint); }
.gl-empty[hidden] { display: none; }

/* vertical letter rail, only where there is room beside the list */
.gl-rail { display: none; }
@media (min-width: 1180px) {
  .gl-rail { position: fixed; z-index: 40; right: 26px; top: calc(50% + 36px); transform: translateY(-50%); max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(10, 10, 9, .72); backdrop-filter: blur(8px); }
  .gl-rail a, .gl-rail button { width: 22px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); font: 600 10.5px var(--font-body); text-decoration: none; cursor: pointer; }
  .gl-rail a:hover, .gl-rail button:hover { color: var(--accent); }
  .gl-rail a.is-active { background: var(--accent); color: var(--bg); }
  .gl-rail a.is-none { display: none; }
  .gl-rail svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}

@media (max-width: 640px) {
  .gl-bar { flex-wrap: wrap; gap: 8px; }
  .gl-bar .lib-search { flex: 1 1 100%; }
  .gl-head { grid-template-columns: minmax(0, 1fr) 18px; gap: 4px 12px; padding: 15px 2px; }
  .gl-short { grid-column: 1; grid-row: 2; }
  .gl-chev { grid-column: 2; grid-row: 1 / span 2; }
  .gl-az a, .gl-az span { min-width: 24px; height: 24px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .gl-chev { transition: none; } }

/* pointer to the dictionary under the article index / in the side rail */
.gl-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(243, 238, 227, .03); color: var(--text-dim); font-size: .8rem; line-height: 1.45; text-decoration: none; transition: border-color .25s ease, color .25s ease; }
.gl-note:hover { border-color: var(--accent-2, #8fa89a); color: var(--text); }
.gl-note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; stroke: var(--accent-2, #8fa89a); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gl-note b { display: block; color: var(--text); font-weight: 600; }

/* one discreet line pointing to the dictionary, under the search of the conditions list and under the banner of the Journal */
.gl-hub-link { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: -6px 0 22px; font-size: .84rem; color: var(--text-faint); }
.gl-hub-link svg { flex: none; width: 16px; height: 16px; stroke: var(--accent-2, #8fa89a); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gl-hub-link a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.gl-hub-link a:hover { border-bottom-color: var(--accent); }
.journal-shell { scroll-margin-top: 90px; }

/* a letter with no terms yet */
.gl-sec.is-empty { margin-bottom: 22px; }
.gl-sec.is-empty .gl-letter { color: var(--text-faint); border-bottom-color: var(--line); }
.gl-none { margin: 0; padding: 12px 2px 4px; font-size: .85rem; font-style: italic; font-weight: 300; color: var(--text-faint); }

/* ---------- right rail of the Journal articles (third column of the article grid, >= 1280px) ---------- */
.art-rail { display: none; }
@media (min-width: 1280px) {
  .art-rail { display: flex; flex-direction: column; gap: 14px; grid-column: 3; align-self: start; position: sticky; top: 130px; }
}
.ar-box { display: grid; gap: 7px; padding: 14px 16px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line-strong)); background: var(--bg-soft); animation: ar-rise .4s var(--ease) backwards; }
.ar-box.is-idle { border-style: dashed; border-color: var(--line-strong); background: transparent; animation: none; }
.ar-term:not(.is-idle) { border-color: color-mix(in srgb, var(--accent-2, #8fa89a) 55%, var(--line-strong)); }
.ar-box .k { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.ar-term .k { color: var(--accent-2, #8fa89a); }
.ar-box .au { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; line-height: 1.25; color: var(--text); }
.ar-box .ti { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-size: .78rem; line-height: 1.5; color: var(--text-dim); font-weight: 300; }
.ar-box .me { font-size: .74rem; color: var(--text-faint); }
.ar-box .idle-t { font-size: .78rem; line-height: 1.5; color: var(--text-faint); font-weight: 300; }
.ar-box .go { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.ar-box .go a { font-size: .78rem; line-height: 1.5; color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.ar-box .go a:hover { border-bottom-color: var(--accent); }
.ar-box .go a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar-prog { gap: 9px; border-style: solid; border-color: var(--line-strong); background: var(--bg); animation: none; }
.ar-prog .k { color: var(--text-faint); }
.ar-prog .bar { height: 4px; border-radius: 999px; background: var(--line-strong); overflow: hidden; }
.ar-prog .bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); }
.ar-prog .t { font-size: .78rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
@keyframes ar-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ar-box { animation: none; } }

/* dictionary box inside the pathology rail: a little more compact, the rail already holds three other blocks */
.cond-rail .ar-term { padding: 12px 14px; gap: 6px; }
.cond-rail .ar-term .ti { -webkit-line-clamp: 3; }
.cond-rail .ar-term .au { font-size: .98rem; }

/* the floating simulator button would sit on top of the letter rail: not shown in the dictionary (the menu still links to the simulator) */
.page-glossary .sim-fab { display: none !important; }

/* the right rails always fit the screen (glossary-tip.js shortens the previews, then drops the secondary line) */
.art-rail { max-height: calc(100vh - 150px); overflow-y: auto; scrollbar-width: none; }
.art-rail::-webkit-scrollbar { display: none; }
.art-rail.is-tight .ar-box, .cond-rail.is-tight .ar-box { padding: 10px 13px; gap: 5px; }
.art-rail.is-tight .ar-box .me, .cond-rail.is-tight .ar-box .me, .cond-rail.is-tight .cond-rctx .me { display: none; }
/* pathology rail: its boxes used to shrink and overlap when the content did not fit; now they keep their size so the script can shorten the previews instead */
.cond-rail > * { flex-shrink: 0; }
.cond-rail .cond-rail-ctx { min-height: auto; }

/* the site's custom cursor (styles.css, z-index 999) sat under the bubble (2000) and vanished inside it: keep it on top, and let the term use it too */
body .cursor-dot, body .cursor-ring { z-index: 2100; }
body.has-custom-cursor .gl-term, body.has-custom-cursor .gl-bubble, body.has-custom-cursor .gl-bubble * { cursor: none; }
