:root {
  --mtlg-black: #000;
  --mtlg-ink: #222;
  --mtlg-muted: #666;
  --mtlg-line: #d8d8d8;
  --mtlg-soft: #f4f4f4;
  --mtlg-link: #2980b9;
}

.mtlg-page {
  padding-bottom: 80px;
  padding-top: 56px;
}

.mtlg-page .content__wrap {
  align-items: flex-start;
}

.mtlg-page-header {
  border-bottom: 4px solid var(--mtlg-black);
  margin-bottom: 28px;
  padding-bottom: 24px;
}

.mtlg-page-header__eyebrow,
.mtlg-section-heading p {
  color: var(--mtlg-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.mtlg-page-header h1,
.mtlg-term-header h1 {
  color: var(--mtlg-ink);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.08;
  margin: 0 0 16px;
}

.mtlg-page-header > p:last-child {
  color: var(--mtlg-muted);
  font-size: 16px;
  line-height: 1.8;
  margin: 0;
}

.mtlg-type-nav {
  border-bottom: 1px solid var(--mtlg-line);
  margin-bottom: 56px;
  padding-bottom: 28px;
}

.mtlg-type-nav > p {
  color: var(--mtlg-muted);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
}

.mtlg-type-nav ul {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.mtlg-type-nav a {
  align-items: center;
  border: 1px solid var(--mtlg-line);
  color: var(--mtlg-ink);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 48px;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
}

.mtlg-type-nav a:hover,
.mtlg-type-nav a:focus-visible {
  border-color: var(--mtlg-black);
  opacity: 1;
}

.mtlg-type-nav a[aria-current="page"] {
  background: var(--mtlg-black);
  border-color: var(--mtlg-black);
  color: #fff;
}

.mtlg-type-section + .mtlg-type-section {
  border-top: 4px solid var(--mtlg-black);
  margin-top: 64px;
  padding-top: 56px;
}

.mtlg-type-section__header {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.mtlg-type-section__header h2 {
  background: transparent;
  color: var(--mtlg-ink);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 900;
  line-height: 1.2;
  margin: 0 0 8px;
  padding: 0;
}

.mtlg-type-section__header p {
  color: var(--mtlg-muted);
  line-height: 1.8;
  margin: 0;
}

.mtlg-type-section__count {
  background: var(--mtlg-soft);
  color: var(--mtlg-ink);
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 10px 12px;
}

.mtlg-index-nav {
  background: var(--mtlg-soft);
  border: 1px solid var(--mtlg-line);
  margin: 0 0 32px;
  padding: 14px;
}

.mtlg-index-nav ul,
.mtlg-chip-list,
.mtlg-term-grid,
.mtlg-term-relations__grid,
.mtlg-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mtlg-index-nav ul {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.mtlg-index-nav a,
.mtlg-index-nav span {
  align-items: center;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 8px;
  text-decoration: none;
}

.mtlg-index-nav a {
  background: #fff;
  border: 1px solid var(--mtlg-black);
  color: var(--mtlg-black);
}

.mtlg-index-nav span {
  color: #aaa;
}

.mtlg-group {
  border-top: 1px solid var(--mtlg-line);
  display: grid;
  gap: 28px;
  grid-template-columns: 116px minmax(0, 1fr);
  padding: 32px 0 52px;
  scroll-margin-top: 32px;
}

.mtlg-group h3 {
  background: transparent;
  color: var(--mtlg-ink);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}

.mtlg-term-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mtlg-term-card {
  border: 1px solid var(--mtlg-line);
  color: var(--mtlg-ink);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 110px;
  padding: 18px;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}

.mtlg-type-badge {
  align-items: center;
  align-self: flex-start;
  background: var(--mtlg-soft);
  border: 1px solid var(--mtlg-line);
  color: var(--mtlg-ink);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  min-height: 25px;
  padding: 5px 8px;
}

.mtlg-type-badge--technical {
  background: var(--mtlg-black);
  border-color: var(--mtlg-black);
  color: #fff;
}

.mtlg-type-badge--product_service {
  background: #fff;
  border-color: var(--mtlg-black);
}

.mtlg-type-badge--event {
  border-style: dashed;
}

.mtlg-term-card:hover,
.mtlg-term-card:focus-visible {
  border-color: var(--mtlg-black);
  opacity: 1;
  transform: translateY(-2px);
}

.mtlg-term-card__title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.mtlg-term-card__reading {
  color: var(--mtlg-muted);
  font-size: 12px;
  margin-top: 3px;
}

.mtlg-term-card__summary {
  color: var(--mtlg-muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 12px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mtlg-empty {
  background: var(--mtlg-soft);
  border-top: 4px solid var(--mtlg-black);
  padding: 40px;
}

.mtlg-empty h2 {
  font-size: 24px;
  margin: 0 0 10px;
}

.mtlg-empty a,
.mtlg-back-link {
  color: var(--mtlg-link);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mtlg-home {
  background: #191919;
  padding: 50px 20px 64px;
}

.mtlg-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mtlg-chip-list a {
  align-items: center;
  background: #fff;
  border: 1px solid #fff;
  border-radius: 999px;
  color: var(--mtlg-black);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  line-height: 1.35;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.mtlg-chip-list a:hover,
.mtlg-chip-list a:focus-visible {
  background: transparent;
  color: #fff;
  opacity: 1;
}

.mtlg-home__empty {
  border: 1px solid #555;
  color: #ccc;
  margin: 0;
  padding: 18px;
}

.mtlg-home__button a {
  margin-top: 32px;
}

.mtlg-article {
  padding-top: 0;
}

.mtlg-term-header {
  border-bottom: 4px solid var(--mtlg-black);
  margin-bottom: 40px;
  padding: 0 0 32px;
}

.mtlg-term-header__back {
  color: var(--mtlg-muted);
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 22px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mtlg-term-header > .mtlg-type-badge {
  display: flex;
  margin-bottom: 12px;
  width: fit-content;
}

.mtlg-term-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  margin: 0;
}

.mtlg-term-meta div {
  align-items: baseline;
  display: flex;
  gap: 10px;
}

.mtlg-term-meta dt {
  color: var(--mtlg-muted);
  font-size: 12px;
  font-weight: 700;
}

.mtlg-term-meta dd {
  color: var(--mtlg-ink);
  font-size: 14px;
  margin: 0;
}

.mtlg-term-lead {
  background: var(--mtlg-soft);
  border-left: 4px solid var(--mtlg-black);
  color: var(--mtlg-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.8;
  margin: 28px 0 0;
  padding: 20px 22px;
}

.mtlg-term-content {
  margin-bottom: 56px;
}

.mtlg-term-relations,
.mtlg-sources,
.mtlg-related {
  border-top: 1px solid var(--mtlg-line);
  margin-top: 48px;
  padding-top: 36px;
}

.mtlg-term-relations h2,
.mtlg-sources h2,
.mtlg-related h2 {
  background: transparent;
  color: var(--mtlg-ink);
  font-size: 25px;
  margin: 0 0 20px;
  padding: 0;
}

.mtlg-term-relations__grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mtlg-related-term-card {
  border: 1px solid var(--mtlg-line);
  color: var(--mtlg-ink);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 128px;
  padding: 18px;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease;
}

.mtlg-related-term-card:hover,
.mtlg-related-term-card:focus-visible {
  border-color: var(--mtlg-black);
  opacity: 1;
  transform: translateY(-2px);
}

.mtlg-related-term-card__title {
  align-items: center;
  display: flex;
  font-size: 18px;
  font-weight: 800;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.35;
}

.mtlg-related-term-card__title::after {
  content: "→";
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
}

.mtlg-related-term-card__summary {
  color: var(--mtlg-muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 10px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mtlg-sources li {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.mtlg-reviewed {
  color: var(--mtlg-muted);
  font-size: 13px;
  margin-top: 20px;
}

.mtlg-reviewed span {
  color: var(--mtlg-ink);
  font-weight: 700;
  margin-right: 8px;
}

.mtlg-related li {
  border-top: 1px solid var(--mtlg-line);
}

.mtlg-related li:last-child {
  border-bottom: 1px solid var(--mtlg-line);
}

.mtlg-related li a {
  align-items: baseline;
  color: var(--mtlg-ink);
  display: grid;
  gap: 18px;
  grid-template-columns: 90px minmax(0, 1fr);
  padding: 15px 4px;
  text-decoration: none;
}

.mtlg-related li a:hover,
.mtlg-related li a:focus-visible {
  color: var(--mtlg-link);
  opacity: 1;
}

.mtlg-related time {
  color: var(--mtlg-muted);
  font-size: 12px;
}

.mtlg-related li span {
  font-weight: 700;
  line-height: 1.5;
}

.mtlg-related__empty {
  color: var(--mtlg-muted);
}

.mtlg-back-link {
  display: inline-block;
  margin-top: 48px;
}

@media (max-width: 900px) {
  .mtlg-type-nav ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mtlg-index-nav ul {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mtlg-term-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .mtlg-page {
    padding-bottom: 56px;
    padding-top: 32px;
  }

  .mtlg-page-header h1,
  .mtlg-term-header h1 {
    font-size: 38px;
  }

  .mtlg-index-nav {
    margin-bottom: 34px;
    padding: 10px;
  }

  .mtlg-type-nav {
    margin-bottom: 42px;
    padding-bottom: 24px;
  }

  .mtlg-type-section + .mtlg-type-section {
    margin-top: 48px;
    padding-top: 42px;
  }

  .mtlg-type-section__header {
    display: block;
  }

  .mtlg-type-section__count {
    display: inline-block;
    margin-top: 14px;
  }

  .mtlg-index-nav ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mtlg-group {
    display: block;
    padding: 28px 0 42px;
  }

  .mtlg-group h3 {
    margin-bottom: 18px;
  }

  .mtlg-term-grid {
    grid-template-columns: 1fr;
  }

  .mtlg-term-card {
    min-height: 0;
  }

  .mtlg-empty {
    padding: 28px 22px;
  }

  .mtlg-home {
    padding: 44px 20px 54px;
  }

  .mtlg-chip-list {
    gap: 8px;
  }

  .mtlg-chip-list a {
    font-size: 14px;
    padding: 9px 14px;
  }

  .mtlg-term-header {
    margin-bottom: 32px;
    padding-bottom: 26px;
  }

  .mtlg-term-meta,
  .mtlg-term-meta div {
    display: block;
  }

  .mtlg-term-meta div + div {
    margin-top: 10px;
  }

  .mtlg-term-meta dd {
    margin-top: 2px;
  }

  .mtlg-term-lead {
    font-size: 16px;
    padding: 17px 18px;
  }

  .mtlg-term-relations__grid {
    grid-template-columns: 1fr;
  }

  .mtlg-related-term-card {
    min-height: 0;
  }

  .mtlg-related li a {
    display: block;
  }

  .mtlg-related time {
    display: block;
    margin-bottom: 4px;
  }
}
