/* Glossary cards: abbreviations in articles open a slide-in card from the right. */

.abbr {
  all: unset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  border-bottom: 1px dotted #999;
  transition: border-color 0.15s, background-color 0.15s;
  border-radius: 2px;
}
.abbr, .abbr * { cursor: pointer; }
.abbr:hover,
.abbr:focus-visible {
  border-bottom-color: #0d0d0d;
  background: rgba(13, 13, 13, 0.06);
}
.abbr:focus-visible { outline: 2px solid #0d0d0d; outline-offset: 2px; }

/* backdrop */
.gl-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(250, 250, 248, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
.gl-backdrop.open { opacity: 1; pointer-events: auto; }

/* card */
.gl-card {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 901;
  width: min(440px, 100vw);
  background: #fff;
  border-left: 1px solid #e6e6e2;
  box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.18);
  transform: translateX(104%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.5s;
  visibility: hidden;
  display: flex; flex-direction: column;
  font-size: 0.95rem; line-height: 1.6; color: #2a2a2a;
}
.gl-card.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}
/* closing is a touch quicker than opening */
.gl-card.closing { transition-duration: 0.32s, 0.32s; transition-timing-function: cubic-bezier(0.5, 0, 0.75, 0), linear; }

.gl-head {
  padding: 22px 24px 16px; border-bottom: 1px solid #eee;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.gl-term { font-size: 2.1rem; line-height: 1; letter-spacing: -0.02em; font-weight: 700; color: #0d0d0d; }
.gl-full { margin-top: 6px; color: #777; font-size: 0.9rem; }
.gl-close {
  all: unset; cursor: pointer; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #555;
  transition: background 0.15s, transform 0.25s;
}
.gl-close:hover { background: #f0f0ec; transform: rotate(90deg); }
.gl-close:focus-visible { outline: 2px solid #0d0d0d; }

.gl-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 40px; overscroll-behavior: contain; }

.gl-tldr {
  font-size: 1.05rem; line-height: 1.5; color: #0d0d0d;
  padding: 12px 14px; background: #f6f6f2; border-radius: 10px;
}
.gl-sec { margin-top: 24px; }
.gl-sec h3 {
  font-family: 'Instrument Serif', Georgia, serif; font-weight: 400;
  font-size: 1.35rem; line-height: 1.1; text-transform: lowercase;
  color: #0d0d0d; margin-bottom: 8px;
}
.gl-sec ul { list-style: none; }
.gl-sec li { position: relative; padding-left: 16px; margin-bottom: 7px; }
.gl-sec li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 5px; height: 5px; border-radius: 50%; background: #0d0d0d; }
.gl-sec li b { color: #0d0d0d; }
.gl-math {
  background: #fafaf8; border: 1px solid #eee; border-radius: 10px;
  padding: 10px 14px; overflow-x: auto; margin-bottom: 8px;
}
.gl-math .gl-cap { font-size: 0.85rem; color: #666; margin-top: 4px; }
.gl-news a { color: #0d0d0d; text-decoration: underline; text-decoration-color: #ccc; text-underline-offset: 2px; }
.gl-news a:hover { text-decoration-color: #0d0d0d; }
.gl-news .gl-src { display: block; font-size: 0.78rem; color: #999; }
.gl-note { font-size: 0.78rem; color: #999; margin-top: 6px; }


/* staggered reveal of card content on open / term switch */
.gl-card.open .gl-head > *, .gl-card.open .gl-scroll > * {
  animation: gl-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.gl-card.open .gl-scroll > :nth-child(1) { animation-delay: 0.10s; }
.gl-card.open .gl-scroll > :nth-child(2) { animation-delay: 0.16s; }
.gl-card.open .gl-scroll > :nth-child(3) { animation-delay: 0.22s; }
.gl-card.open .gl-scroll > :nth-child(4) { animation-delay: 0.28s; }
.gl-card.open .gl-scroll > :nth-child(5) { animation-delay: 0.34s; }
.gl-card.open .gl-scroll > :nth-child(6) { animation-delay: 0.40s; }
@keyframes gl-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

body.gl-lock { overflow: hidden; }

@media (max-width: 520px) {
  .gl-card { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  .gl-card, .gl-card.open, .gl-card.closing, .gl-backdrop { transition-duration: 0.01s !important; }
  .gl-card.open .gl-head > *, .gl-card.open .gl-scroll > * { animation: none; }
  .gl-close:hover { transform: none; }
}

.gl-points { text-transform: lowercase; }
.gl-points code { text-transform: none; }

/* sub-facts and links between cards */
.gl-sub { margin-top: 6px; }
.gl-sub li::before { background: #bbb; }
.gl-link {
  all: unset; cursor: pointer; text-transform: none;
  border-bottom: 1px dotted #0d0d0d; color: #0d0d0d;
}
.gl-link:hover { background: rgba(13,13,13,0.06); }
.gl-link:focus-visible { outline: 2px solid #0d0d0d; outline-offset: 2px; }
.gl-back {
  all: unset; cursor: pointer; display: inline-block; margin-bottom: 8px;
  font-size: 0.85rem; color: #777; transition: color 0.15s;
}
.gl-back[hidden] { display: none; }
.gl-back:hover { color: #0d0d0d; }
.gl-back:focus-visible { outline: 2px solid #0d0d0d; outline-offset: 2px; }
