/* Ensure glossary terms are underlined */
.glossary-highlight {
    border-bottom: 1px dashed red !important;

    cursor: pointer !important;
    position: relative !important;
    display: inline !important;
}

/* Glossary Tooltip */
.glossary-tooltip {
    display: none;
    position: absolute;
    background: #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
}




/* Show tooltip on hover */
.wp-block-post-content .glossary-highlight:hover .glossary-tooltip {
    display: block;
}

/* ✅ Base styles for glossary terms */
.glossary-highlight {
    position: relative;
    border-bottom: 1px dashed red;
    cursor: pointer;
}

/* ✅ Responsive Tooltip Styling */
.glossary-highlight::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 120%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    white-space: normal;  /* ✅ Allows text wrapping */
    max-width: 90vw;  /* ✅ Prevents tooltip from being wider than screen */
    width: max-content;
    min-width: 150px;
    max-width: 280px;  /* ✅ Limits tooltip width for better readability */
    border-radius: 6px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 1000;
    overflow-wrap: break-word; /* ✅ Ensures long words break correctly */
}

/* ✅ Show tooltip on hover */
.glossary-highlight:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ✅ Ensure tooltips stay inside the screen on small devices */
@media (max-width: 600px) {
    .glossary-highlight::after {
        max-width: 80vw;  /* ✅ Tooltip takes up max 80% of viewport width */
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* ✅ Glossary Widget Container */
.glossary-widget {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    max-width: 100%;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* ✅ Word/Phrase */
.glossary-term {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

/* ✅ Definition */
.glossary-definition {
    font-size: 1em;
    color: #555;
    line-height: 1.4;
}

/* ✅ Mobile Responsive */
@media (max-width: 600px) {
    .glossary-widget {
        padding: 10px;
    }
    .glossary-term {
        font-size: 1.2em;
    }
    .glossary-definition {
        font-size: 0.95em;
    }
}

/* ✅ Glossary Container */
.glossary-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* ✅ Glossary Header */
.glossary-header {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

/* ✅ Glossary Letter Buttons */
.glossary-letters {
    text-align: center;
    margin-bottom: 15px;
}

.glossary-letter {
    display: inline-block;
    padding: 8px 12px;
    margin: 4px;
    font-size: 1em;
    font-weight: bold;
    background: #0073aa;
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.glossary-letter:hover {
    background: #005f87;
}

/* ✅ Glossary Term List */
.glossary-terms {
    list-style: none;
    padding: 0;
    margin: 0;
}

.glossary-term {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 4px solid #0073aa;
    border-radius: 5px;
}

.glossary-term h3 {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 5px;
    color: #333;
}

.glossary-term p {
    font-size: 1em;
    color: #555;
    margin: 0;
}

/* ✅ Mobile Optimization */
@media (max-width: 768px) {
    .glossary-container {
        padding: 10px;
    }

    .glossary-letter {
        font-size: 0.9em;
        padding: 6px 10px;
    }

    .glossary-term h3 {
        font-size: 1.1em;
    }

    .glossary-term p {
        font-size: 0.95em;
    }
}
/* ✅ Glossary Widget */
.glossary-widget {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    max-width: 100%;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* ✅ Widget Term */
.glossary-widget-term {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

/* ✅ Widget Definition */
.glossary-widget-definition {
    font-size: 1em;
    color: #555;
    line-height: 1.4;
}

/* ✅ Glossary Container */
.glossary-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* ✅ Glossary Term List */
.glossary-terms {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ✅ Shortcode Term (Styled Again) */
.glossary-list-term {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    display: block;
    text-align: left;
    padding: 10px;
    background: #f9f9f9;
    border-left: 4px solid #0073aa;
    border-radius: 5px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

/* ✅ Shortcode Definition */
.glossary-list-definition {
    font-size: 1em;
    color: #555;
    line-height: 1.5;
    text-align: left;
    padding-left: 10px;
}

.glossary-card{
  z-index:9999;background:#fff;border:1px solid #e5e7eb;border-radius:8px;
  padding:.75rem 1rem;box-shadow:0 12px 30px rgba(0,0,0,.15);max-width:420px
}
.glossary-card-head{font-weight:600;margin:0 0 .35rem}
.glossary-card-body p{margin:.35rem 0}
.glossary-card-body ul,.glossary-card-body ol{margin:.35rem 0 .5rem 1.25rem}
.glossary-card-body a{text-decoration:underline}

/* ——— Disable legacy tooltip variants ——— */
.glossary-tooltip { display: none !important; }
.wp-block-post-content .glossary-highlight:hover .glossary-tooltip { display: none !important; }
.glossary-highlight::after { content: none !important; display: none !important; }

/* Keep the underline/interaction style for highlights */
.glossary-highlight {
  border-bottom: 1px dashed red;
  cursor: pointer;
  position: relative;
}

/* New popup card (kept) */
.glossary-card{
  z-index:9999;background:#fff;border:1px solid #e5e7eb;border-radius:8px;
  padding:.75rem 1rem;box-shadow:0 12px 30px rgba(0,0,0,.15);max-width:420px
}
.glossary-card-head{font-weight:600;margin:0 0 .35rem}
.glossary-card-body p{margin:.35rem 0}
.glossary-card-body ul,.glossary-card-body ol{margin:.35rem 0 .5rem 1.25rem}
.glossary-card-body a{text-decoration:underline}

/* Related Articles: media-card layout */
.glossary-related-cards {
  list-style: none;
  margin: .25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

.glossary-related-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: .75rem;
  align-items: start;
}

.glossary-related-thumbwrap {
  display: block;
  width: 72px;
  min-width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.glossary-related-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.glossary-related-thumb.placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.glossary-related-meta {
  min-width: 0; /* allow text to wrap nicely */
}

.glossary-related-title {
  margin: 0 0 .25rem;
  font-size: 1rem;
  line-height: 1.25;
}

.glossary-related-title a {
  text-decoration: none;
}

.glossary-related-title a:hover,
.glossary-related-title a:focus {
  text-decoration: underline;
}

.glossary-related-excerpt {
  margin: 0;
  color: #555;
  font-size: .9rem;
  line-height: 1.4;
}

/* Optional: on wider screens, two columns */
@media (min-width: 720px) {
  .glossary-related-cards {
    grid-template-columns: 1fr 1fr;
    gap: 1rem .75rem;
  }
}

/* --- Related Articles: isolation + float clear + spacing resets --- */
#glossary-related-block {
  clear: both;                 /* drop below any floating references list */
  display: block;
  position: relative;
  isolation: isolate;          /* new stacking context; prevents z-index bleed */
  overflow: auto;              /* new BFC; stops background/float overlap + margin collapse */
  width: 100%;

  margin-top: 1.5rem;          /* visible separation from references */
  padding: 1rem 1.25rem;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

/* Avoid overly broad .references h2, .references ul li … rules leaking in */
#glossary-related-block * {
  box-sizing: border-box;
}

/* Headings inside our block: give them their own baseline regardless of theme refs styles */
#glossary-related-block .glossary-related-heading {
  margin: 0 0 .5rem;
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 700;
}

/* Reset list to prevent refs list styles from applying */
#glossary-related-block .glossary-related-cards {
  list-style: none;
  margin: .25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

/* Card layout (thumb left, text right) */
#glossary-related-block .glossary-related-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: .75rem;
  align-items: start;
}

#glossary-related-block .glossary-related-thumbwrap {
  display: block;
  width: 72px;
  min-width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

#glossary-related-block .glossary-related-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#glossary-related-block .glossary-related-thumb.placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

#glossary-related-block .glossary-related-meta { min-width: 0; }

#glossary-related-block .glossary-related-title {
  margin: 0 0 .25rem;
  font-size: 1rem;
  line-height: 1.25;
}

#glossary-related-block .glossary-related-title a {
  text-decoration: none;
}
#glossary-related-block .glossary-related-title a:hover,
#glossary-related-block .glossary-related-title a:focus {
  text-decoration: underline;
}

#glossary-related-block .glossary-related-excerpt {
  margin: 0;
  color: #555;
  font-size: .9rem;
  line-height: 1.4;
}

#glossary-related-block .glossary-related-empty {
  color: #666;
  margin: .25rem 0 0;
}

/* Two columns on wider screens */
@media (min-width: 720px) {
  #glossary-related-block .glossary-related-cards {
    grid-template-columns: 1fr 1fr;
    gap: 1rem .75rem;
  }
}

