/* assets/glossary/glossary.css
 * Scoped styles for the BIM Knowledge Base (glossary-index + glossary-term).
 * BEM, mobile-first. Variables from :root in styles.css (--primary, --secondary, --accent).
 * Extra cluster palette tokens are defined here; not added to the global stylesheet.
 */

/* ── Cluster colour palette — tints of the three Revit primaries ─────────── */
:root {
  --kb-navy:        #0B3C5D;
  --kb-navy-mid:    #1A6091;
  --kb-navy-light:  #4A90B8;
  --kb-teal:        #1D7874;
  --kb-teal-mid:    #2EA89F;
  --kb-teal-light:  #5DC9C2;
  --kb-gold:        #D9B310;
  --kb-gold-mid:    #E8CE50;
  --kb-gold-light:  #F0DE90;
  --kb-slate:       #5B6B7A;
  --kb-geometry:    #9A6A50;
}

/* ══════════════════════════════════════════════════════════
   KNOWLEDGE BASE INDEX
══════════════════════════════════════════════════════════ */

.kb-index {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.kb-index__hero {
  margin-bottom: 2rem;
}

.kb-index__h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.kb-index__intro {
  font-size: 1.05rem;
  color: #444;
  max-width: 65ch;
  line-height: 1.6;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   GRAPH MOUNTS
══════════════════════════════════════════════════════════ */

.kb-graph,
.kb-graph-mini {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #f4f8fc;
  margin-bottom: 2rem;
}

/* Index graph: full-bleed, hairline top/bottom borders */
.kb-graph {
  border-top: 1px solid #dce6f0;
  border-bottom: 1px solid #dce6f0;
  min-height: 400px;
}

/* Mini graph: contained with rounded corners + full border */
.kb-graph-mini {
  border-radius: 6px;
  border: 1px solid #dce6f0;
  min-height: 260px;
  margin-top: 1.5rem;
}

.kb-graph svg,
.kb-graph-mini svg {
  display: block;
  width: 100%;
  touch-action: pan-y; /* D-46: one-finger vertical swipe scrolls the page; pinch zooms the graph */
}

/* Graph SVG elements */
.kb-graph__link {
  stroke: #b8cad9;
  stroke-width: 1.5;
}

.kb-graph__node {
  outline: none;
}

.kb-graph__node:focus-visible .kb-graph__circle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.kb-graph__node:hover .kb-graph__circle {
  opacity: 0.82;
}

.kb-graph__label {
  font-size: 10px;
  font-family: inherit;
  pointer-events: none;
}

.kb-graph__tooltip {
  position: absolute;
  background: rgba(11, 60, 93, 0.94);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  pointer-events: none;
  max-width: 240px;
  z-index: 20;
  transition: opacity 0.1s ease;
}

.kb-graph__tooltip-short {
  opacity: 0.85;
}

.kb-graph__controls {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.kb-graph__control {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dce6f0;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(11, 60, 93, 0.1);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.kb-graph__control:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: #fff;
}

.kb-graph__control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════
   TERM GRID
══════════════════════════════════════════════════════════ */

.kb-grid {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 768px) {
  .kb-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .kb-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Cluster group */
.kb-cluster {
  border-top: 3px solid transparent;
  padding-top: 0.8rem;
}

.kb-cluster--navy        { border-top-color: var(--kb-navy);       }
.kb-cluster--navy-mid    { border-top-color: var(--kb-navy-mid);   }
.kb-cluster--navy-light  { border-top-color: var(--kb-navy-light); }
.kb-cluster--teal        { border-top-color: var(--kb-teal);       }
.kb-cluster--teal-mid    { border-top-color: var(--kb-teal-mid);   }
.kb-cluster--teal-light  { border-top-color: var(--kb-teal-light); }
.kb-cluster--gold        { border-top-color: var(--kb-gold);       }
.kb-cluster--gold-mid    { border-top-color: var(--kb-gold-mid);   }
.kb-cluster--gold-light  { border-top-color: var(--kb-gold-light); }
.kb-cluster--slate       { border-top-color: var(--kb-slate);      }

.kb-cluster__heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: #666;
  margin: 0 0 0.75rem;
  padding-bottom: 0.3rem;
}

.kb-cluster__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Term card */
.kb-card__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 1rem;
  border: 1px solid #dde4ee;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kb-card__link:hover {
  border-color: var(--secondary);
  box-shadow: 0 2px 8px rgba(29, 120, 116, 0.12);
}

.kb-card__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.kb-card__term {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
  line-height: 1.3;
}

.kb-card__acronym {
  font-size: 0.73rem;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kb-card__short {
  font-size: 0.83rem;
  color: #555;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════
   TERM DETAIL PAGE
══════════════════════════════════════════════════════════ */

.kb-term {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.kb-term__hero {
  margin-bottom: 1.5rem;
}

.kb-term__h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.4rem;
  line-height: 1.2;
}

.kb-term__acronym {
  font-size: 1.1rem;
  color: var(--secondary);
  font-weight: 400;
}

.kb-term__lead {
  font-size: 1.1rem;
  color: #444;
  line-height: 1.6;
  margin: 0.25rem 0 0;
}

/* Body — raw HTML authored by us */
.kb-term__body {
  font-size: 1rem;
  line-height: 1.75;
  color: #333;
  margin-bottom: 2rem;
}

.kb-term__body p {
  margin: 0 0 1em;
}

.kb-term__body ul,
.kb-term__body ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.kb-term__back {
  margin-top: 2.5rem;
  font-size: 0.875rem;
}

.kb-term__back a {
  color: var(--secondary);
  text-decoration: none;
}

.kb-term__back a:hover {
  text-decoration: underline;
}

/* ── Related terms ── */
.kb-related {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--secondary);
  background: #f3fafa;
  border-radius: 0 6px 6px 0;
}

.kb-related__heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--secondary);
  margin: 0 0 0.7rem;
}

.kb-related__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.kb-related__link {
  display: inline-block;
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 3px;
  background: var(--secondary);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}

.kb-related__link:hover {
  background: var(--primary);
}

.kb-related__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.kb-related__item--pending .kb-related__text {
  display: inline-block;
  font-size: 0.83rem;
  padding: 0.25rem 0.65rem;
  border-radius: 3px;
  background: #e8edf3;
  color: #999;
}

/* ── Sources ── */
.kb-sources {
  margin: 2rem 0;
  padding-top: 1rem;
  border-top: 1px solid #dde4ee;
}

.kb-sources__heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: #888;
  margin: 0 0 0.5rem;
}

.kb-sources__list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.kb-sources__item {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  background: #edf1f7;
  border-radius: 3px;
  color: #555;
}

.kb-sources__note {
  font-size: 0.77rem;
  color: #999;
  font-style: italic;
  margin: 0;
}

/* ── Service CTA ── */
.kb-service-cta {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fdf9ec;
}

.kb-service-cta__label {
  font-size: 0.83rem;
  color: #666;
  margin: 0 0 0.3rem;
}

.kb-service-cta__link {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.kb-service-cta__link:hover {
  color: var(--secondary);
}

.kb-service-cta__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .kb-index__h1,
  .kb-term__h1 {
    font-size: 1.5rem;
  }

  .kb-graph {
    min-height: 280px;
  }

  .kb-graph-mini {
    min-height: 220px;
  }
}
