/**
 * Menyala Gadgetku Glossary Popup
 * Brand colors:
 * Midnight Navy #0F172A
 * Precision Blue #2563EB
 * Clean White #FFFFFF
 * Soft Background #F8FAFC
 * Tech Accent #38BDF8
 */

.mg-glossary {
  --mg-navy: #0F172A;
  --mg-blue: #2563EB;
  --mg-white: #FFFFFF;
  --mg-soft: #F8FAFC;
  --mg-accent: #38BDF8;

  position: relative;
  display: inline;
  isolation: isolate;
  max-width: 100%;
  cursor: help;
  outline: none;
  vertical-align: baseline;
  line-height: inherit;
}

.mg-glossary__term {
  position: relative;
  display: inline;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-decoration: none !important;
  border-radius: 0.28em;
  padding: 0 0.08em;
  background:
    linear-gradient(180deg, rgba(255,255,255,0) 60%, rgba(56,189,248,0.18) 60%),
    linear-gradient(90deg, rgba(37,99,235,0.13), rgba(56,189,248,0.20));
  background-size: 100% 100%, 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 0, 0 100%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.mg-glossary__term::after {
  content: "i";
  position: relative;
  top: -0.42em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.02em;
  height: 1.02em;
  margin-left: 0.16em;
  color: var(--mg-blue);
  background: rgba(248, 250, 252, 0.98);
  border: 1px solid rgba(37, 99, 235, 0.33);
  border-radius: 999px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.56em;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}

.mg-glossary:hover .mg-glossary__term,
.mg-glossary:focus .mg-glossary__term,
.mg-glossary:focus-visible .mg-glossary__term,
.mg-glossary[data-mg-open="true"] .mg-glossary__term {
  color: var(--mg-navy);
  background:
    linear-gradient(180deg, rgba(255,255,255,0) 45%, rgba(56,189,248,0.30) 45%),
    linear-gradient(90deg, rgba(37,99,235,0.38), rgba(56,189,248,0.55));
  background-size: 100% 100%, 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 0, 0 100%;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.11);
}

.mg-glossary:hover .mg-glossary__term::after,
.mg-glossary:focus .mg-glossary__term::after,
.mg-glossary:focus-visible .mg-glossary__term::after,
.mg-glossary[data-mg-open="true"] .mg-glossary__term::after {
  color: var(--mg-white);
  background: var(--mg-blue);
  border-color: var(--mg-blue);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.95),
    0 4px 10px rgba(37, 99, 235, 0.22);
}

.mg-glossary__popup {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 9999;
  display: block;
  width: min(280px, calc(100vw - 28px));
  padding: 10px 11px;
  color: var(--mg-navy);
  background: var(--mg-white);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transform-origin: center bottom;
  transition: opacity 120ms ease, visibility 120ms ease, transform 120ms ease;
  white-space: normal;
  text-align: left;
  line-height: 1.45;
}


.mg-glossary__popup::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: var(--mg-white);
  border-right: 1px solid rgba(15, 23, 42, 0.12);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}

.mg-glossary:hover .mg-glossary__popup,
.mg-glossary:focus .mg-glossary__popup,
.mg-glossary:focus-within .mg-glossary__popup,
.mg-glossary[data-mg-open="true"] .mg-glossary__popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mg-glossary__body {
  display: block;
  color: rgba(15, 23, 42, 0.86);
  font-size: 0.86rem;
  font-weight: 500;
}


.mg-glossary--edge-left .mg-glossary__popup::after {
  left: 22px;
  transform: rotate(45deg);
}

.mg-glossary--edge-right .mg-glossary__popup::after {
  right: 22px;
  left: auto;
  transform: rotate(45deg);
}

.mg-glossary--edge-left .mg-glossary__popup {
  left: 0;
  transform: translateX(0) translateY(4px);
  transform-origin: left bottom;
}

.mg-glossary--edge-left:hover .mg-glossary__popup,
.mg-glossary--edge-left:focus .mg-glossary__popup,
.mg-glossary--edge-left:focus-within .mg-glossary__popup,
.mg-glossary--edge-left[data-mg-open="true"] .mg-glossary__popup {
  transform: translateX(0) translateY(0);
}

.mg-glossary--edge-right .mg-glossary__popup {
  right: 0;
  left: auto;
  transform: translateX(0) translateY(4px);
  transform-origin: right bottom;
}

.mg-glossary--edge-right:hover .mg-glossary__popup,
.mg-glossary--edge-right:focus .mg-glossary__popup,
.mg-glossary--edge-right:focus-within .mg-glossary__popup,
.mg-glossary--edge-right[data-mg-open="true"] .mg-glossary__popup {
  transform: translateX(0) translateY(0);
}

@media (max-width: 767px) {
  .mg-glossary__term::after {
    font-size: 0.6em;
    top: -0.36em;
  }

  .mg-glossary__popup {
    width: min(270px, calc(100vw - 24px));
    padding: 10px;
    border-radius: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-glossary__term,
  .mg-glossary__popup {
    transition: none;
  }
}
