#page-title::first-letter,
#incident-title::first-letter {
  text-transform: capitalize;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline-color);
}

a:hover {
  color: inherit;
  text-decoration-color: var(--link-underline-hover-color);
}

#incident a.text-secondary.text-decoration-none:hover h2 {
  text-decoration: underline;
  text-decoration-color: var(--link-underline-color);
}

th {
  font-weight: 500 !important;
}

.btn, .nav-link, .navbar-brand {
  text-decoration: none;
}

.btn:hover, .nav-link:hover, .navbar-brand:hover {
  text-decoration: none;
}

.badge {
  max-width: 270px;
  text-overflow: ellipsis;
  overflow: hidden;
}

a.badge {
  transition: background-color 0.15s ease, color 0.15s ease;
}

a.badge:hover {
  background-color: #212529 !important;
  color: var(--badge-color) !important;
}

p.field-parties .badge-notidentifiable {
  display: none;
}

/* BOOTSTRAP PRIMARY OVERRIDE */
:root {
  --bs-primary: #177df5;
  --bs-primary-rgb: 23, 125, 245;
  --bs-border-radius: 3px;
  --bs-border-radius-sm: 3px;
  --bs-border-radius-lg: 3px;
  --bs-border-radius-xl: 3px;
  --bs-border-radius-xxl: 3px;
  --bs-border-radius-pill: 3px;

  /* Custom variables that adapt to theme */
  --link-underline-color: rgba(0, 0, 0, 0.5);
  --link-underline-hover-color: rgba(0, 0, 0, 1);
  --table-hover-bg: #f8f9fa;
  --card-bg: #fff;
  --card-border-color: rgba(0, 0, 0, 0.12);
  --timeline-marker-bg: #fff;
  --link-hover-color: #0a58ca;
}

[data-bs-theme="dark"] {
  --bs-body-color: #c9d1d9;
  --bs-body-color-rgb: 201, 209, 217;
  --link-underline-color: rgba(255, 255, 255, 0.5);
  --link-underline-hover-color: rgba(255, 255, 255, 1);
  --table-hover-bg: #2b3035;
  --card-bg: var(--bs-body-bg);
  --card-border-color: rgba(255, 255, 255, 0.12);
  --timeline-marker-bg: var(--bs-body-bg);
  --link-hover-color: #3da1ff;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #177df5;
  --bs-btn-border-color: #177df5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #0d6de0;
  --bs-btn-hover-border-color: #0c67d4;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #0c67d4;
  --bs-btn-active-border-color: #0b61c7;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #177df5;
  --bs-btn-disabled-border-color: #177df5;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.nav-link.active {
  font-weight: 700;
  text-decoration: underline;
}

#lang-en.active,
#lang-id.active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

div.bg-body.py-3 {
  flex: 1 0 auto;
}

div.bg-white.py-3 {
  flex: 1 0 auto;
}

#custom-info,
.dt-length {
  color: var(--bs-secondary-color);
}

/* TABLES */
.table-hover > tbody > tr:hover > * {
  --bs-table-bg: var(--table-hover-bg);
}
table.table thead th,
table.table  tbody td {
  off-border-left: none;
  off-border-right: none;
  min-width: 180px;
}

table.table  thead th:first-child,
table.table  tbody td:first-child {
  min-width: 270px;
}

/* Issues & Temporal taxonomies only have a few columns, so cap their width on
   widescreen to keep definition text lines comfortably readable. The Harms
   table (jenis kerugian) has many columns and is left full-width. */
.taxonomies-table {
  max-width: 900px;
}

#taxonomies-issues,
#taxonomies-temporal {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#taxonomies-issues > h3,
#taxonomies-temporal > h3,
#taxonomies-harms > h3 {
  align-self: center;
  width: 100%;
  max-width: 900px;
  font-size: 1.5rem;
}

#taxonomies-harms > h3 {
  max-width: none;
}

#taxonomies-issues .taxonomies-table,
#taxonomies-temporal .taxonomies-table {
  width: 100%;
}


/* Active filter chip bar: keep the "Active filters:" label from being cropped
   by long chip values, and let chips wrap instead of overflowing. */
#active-facets > .small.text-secondary.fw-semibold {
  flex-shrink: 0;
}

#active-facets-chips {
  flex-wrap: wrap;
  min-width: 0;
}

#active-facets-chips .badge {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}


#incidents-table tbody tr {
  cursor: pointer;
}

#incidents-table tbody tr:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

/* The capped Issues/Temporal tables use natural column sizing, but their
   per-column minimums are kept small enough that the total stays within the
   900px cap above (otherwise the min-widths would force the table wider than
   the cap and break it on widescreen). */
#issues-table thead th:first-child,
#issues-table tbody td:first-child {
  min-width: 200px;
  width: 30%;
}

#issues-table thead th:nth-child(2),
#issues-table tbody td:nth-child(2) {
  min-width: 300px;
  width: 70%;
}

#temporal-table thead th,
#temporal-table tbody td,
#harms-table thead th,
#harms-table tbody td {
  min-width: 0;
}

#temporal-table thead th:nth-child(1),
#temporal-table thead th:nth-child(2),
#temporal-table tbody td:nth-child(1),
#temporal-table tbody td:nth-child(2) {
  min-width: 180px;
  width: 22%;
}

#temporal-table thead th:nth-child(3),
#temporal-table tbody td:nth-child(3) {
  min-width: 300px;
  width: 56%;
}

/* Harms table (jenis kerugian) is full-width with many columns and lives in a
   horizontal scroll container, so it keeps generous per-column minimums. */
#harms-table thead th,
#harms-table tbody td {
  min-width: 360px;
}

#harms-table thead th:nth-child(1),
#harms-table thead th:nth-child(2),
#harms-table thead th:nth-child(4),
#harms-table tbody td:nth-child(1),
#harms-table tbody td:nth-child(2),
#harms-table tbody td:nth-child(4) {
  min-width: 180px;
}

#harms-table thead th:nth-child(5),
#harms-table tbody td:nth-child(5) {
  min-width: 120px;
}

.clickable-taxonomy-cell {
  cursor: pointer;
  font-weight: bold;
  color: var(--bs-primary);
  white-space: normal;
}

.clickable-taxonomy-cell:hover {
  text-decoration: underline;
  text-decoration-color: var(--link-underline-color);
}

/* Inline "View incidents" affordance appended to clickable cells so users
   understand the classification links through to a filtered incident search. */
.taxonomy-view-incidents {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--bs-primary);
  background-color: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.1));
  border: 1px solid var(--bs-primary-border-subtle, rgba(13, 110, 253, 0.25));
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.taxonomy-view-incidents:hover,
.taxonomy-view-incidents:focus-visible {
  color: var(--bs-primary-text-emphasis, #fff);
  background-color: var(--bs-primary);
  text-decoration: none;
}

.taxonomy-view-incidents i {
  font-size: 0.85em;
}

#temporal-table tbody td:nth-child(2) {
  opacity: .67;
  font-weight: bold;
}

@media (max-width: 575.98px) {
  .taxonomies-table,
  .taxonomies-table thead,
  .taxonomies-table tbody,
  .taxonomies-table tr,
  .taxonomies-table th,
  .taxonomies-table td {
    display: block;
    min-width: 0;
    width: 100%;
    border: 0;
  }
  .taxonomies-table thead {
    display: none;
  }
  .taxonomies-table tbody tr td {
    padding-top: 0;
  }
  .taxonomies-table tbody tr td:first-child {
    border-top: var(--bs-border-width) solid var(--bs-border-color);
    padding-top: 0.5rem;
    padding-bottom: 0;
  }
  #temporal-table tbody tr td:nth-last-child(2) {
    border-top: var(--bs-border-width) dotted var(--bs-border-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0;
  }
  #temporal-table tbody tr:last-child td:nth-child(2) {
    display: none;
  }
  .taxonomies-table tbody tr td:last-child {
    padding-bottom: 0.5rem;
  }
  .taxonomies-table tbody tr:last-child td:last-child {
    border-bottom: var(--bs-border-width) solid var(--bs-border-color);
  }
}

/* Override the generic a { color: inherit } for markdown fields */
#incident-description a,
#field-regulation a,
#field-regulatory-gap a,
#field-harm-analysis a,
#field-harm-level-analysis a,
#field-source a {
  color: var(--bs-primary);
  text-decoration-color: var(--bs-primary);
  overflow-wrap: anywhere;
}
#incident-description a:hover,
#field-regulation a:hover,
#field-regulatory-gap a:hover,
#field-harm-analysis a:hover,
#field-harm-level-analysis a:hover,
#field-source a:hover {
  color: var(--link-hover-color);
  text-decoration-color: var(--link-hover-color);
}

.taxonomies-table td p:last-child,
#harms-table td p:last-child {
  margin-bottom: 0;
}

/* VERTICAL TIMELINE */
/* Grid layout: a fixed marker gutter + content column. The marker is centred
   in its gutter cell, so it stays locked to the connector in every theme
   without magic-number offsets. */
.vertical-timeline {
  position: relative;
}
.vertical-timeline-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-areas:
    "marker date"
    "marker title";
  column-gap: 12px;
  position: relative;
  padding-bottom: 24px;
}
.vertical-timeline-item:last-child {
  padding-bottom: 0;
}
/* Connector: links each marker to the next. It intentionally overshoots a
   little into the following item, where the next (opaque, higher-z) marker
   hides the overlap — so there are no stubs above the first or below the last. */
.vertical-timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: -12px;
  width: 2px;
  background: var(--bs-primary);
  transform: translateX(-50%);
  z-index: 1;
}
.vertical-timeline-marker {
  grid-area: marker;
  align-self: start;
  justify-self: center;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--timeline-marker-bg);
  border: 3px solid var(--bs-primary);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  position: relative;
  z-index: 2;
}
.vertical-timeline-item.active .vertical-timeline-marker {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 4px rgba(23, 125, 245, 0.2);
}
.vertical-timeline-item a:hover .vertical-timeline-marker {
  border-color: #0c67d4;
  background-color: #0c67d4;
}
.vertical-timeline-date {
  grid-area: date;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  margin-bottom: 2px;
}
.vertical-timeline-title {
  grid-area: title;
  font-size: 1rem;
  font-weight: 500;
}
.vertical-timeline-title a {
  color: var(--bs-body-color);
  text-decoration: none;
}
.vertical-timeline-title a:hover {
  color: var(--bs-primary);
  text-decoration: underline;
  text-decoration-color: var(--bs-primary);
}
.vertical-timeline-item.active .vertical-timeline-title {
  font-weight: 700;
}

/* SIMILAR CASES CARD GRID */
.similar-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--card-border-color);
  border-radius: var(--bs-border-radius);
  background-color: var(--card-bg);
}
.similar-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(23, 125, 245, 0.3);
}

.incident-card:focus-visible,
.similar-card:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.incident-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(23, 125, 245, 0.3);
}

.incident-card:hover .incident-card-link {
  color: var(--bs-primary);
}
.similar-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2.8em;
}
.similar-card-date {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
  margin-bottom: 12px;
}
.similar-card-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-primary) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.similar-card-link:hover {
  color: #0c67d4 !important;
  text-decoration: underline;
}

/* Modern Laws Explorer & Table Styling */
.laws-group {
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.laws-doc-header-btn {
  color: var(--bs-body-color);
}
.laws-group-chevron {
  transition: transform 0.25s ease-in-out;
}
.laws-doc-header-btn[aria-expanded="true"] .laws-group-chevron,
.laws-doc-header-btn:not(.collapsed) .laws-group-chevron {
  transform: rotate(180deg);
}

.laws-table {
  width: 100%;
  margin-bottom: 0;
}
.laws-table th {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.75rem 1rem;
}
.laws-table td {
  padding: 0.85rem 1rem;
}

.laws-col-pasal {
  width: 13rem;
  min-width: 11rem;
}
.laws-col-text {
  min-width: 15rem;
}
.laws-col-incidents {
  width: 6rem;
  white-space: nowrap;
}
.laws-col-linked {
  width: 4.5rem;
  white-space: nowrap;
}

.laws-text-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
  font-size: 0.9rem;
}

.laws-article-row {
  transition: background-color 0.15s ease-in-out;
}
.laws-row-expandable:hover {
  background-color: var(--bs-tertiary-bg) !important;
}
.laws-row-expanded {
  background-color: var(--bs-tertiary-bg) !important;
}

.laws-toggle {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.laws-detail-container {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.laws-detail-text-content {
  font-size: 0.925rem;
  line-height: 1.6;
}
.laws-detail-text-content p:last-child {
  margin-bottom: 0;
}

/* Paragraph and project info links blue styling */
p a,
#project-info a {
  color: var(--bs-primary);
  text-decoration: underline;
  text-decoration-color: var(--bs-primary);
}

p a:hover,
#project-info a:hover {
  color: var(--link-hover-color);
  text-decoration-color: var(--link-hover-color);
}

/* GLOBAL TRANSITIONS */
body, .bg-body, .card, .navbar, .nav-link {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

/* DASHBOARD DYNAMIC METRICS CARDS */
.dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border-color);
  border-radius: var(--bs-border-radius-lg);
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08) !important;
  border-color: rgba(23, 125, 245, 0.4) !important;
}

/* CUSTOM NAV-TABS STYLING */
.nav-tabs {
  border-bottom: 1px solid var(--card-border-color);
}

.nav-tabs .nav-link {
  color: var(--bs-secondary-color);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

.nav-tabs .nav-link:hover {
  border-bottom-color: var(--bs-border-color);
  color: var(--bs-body-color);
  background: none;
}

.nav-tabs .nav-link.active {
  color: var(--bs-primary) !important;
  background: none !important;
  border-bottom: 3px solid var(--bs-primary) !important;
}

/* RESPONSIVE DASHBOARD CUSTOM STYLING */
#stat-range {
  font-size: 1rem;
  line-height: 1.25;
}

@media (min-width: 992px) {
  #stat-range {
    font-size: 1.15rem;
  }
  #dashboard-tabs-content {
    min-height: 60vh;
  }
}

/* QUICK FILTERS ACTIVE STATE */
.quick-filter-pill.active {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #fff !important;
}

/* CUSTOM DATATABLES PAGINATION IN EXPONENT TOOLBAR */
#custom-paging .page-link {
  color: var(--bs-body-color);
  background-color: var(--card-bg);
  border-color: var(--card-border-color);
  padding: 0.375rem 0.75rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#custom-paging .page-link:hover {
  background-color: var(--table-hover-bg);
  border-color: var(--card-border-color);
  color: var(--bs-primary);
}

#custom-paging .page-item.active .page-link {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #fff !important;
}

#custom-paging .page-item.disabled .page-link {
  background-color: var(--table-hover-bg);
  color: var(--bs-secondary-color);
  opacity: 0.6;
}

/* RESEARCH ARTICLE DETAIL LAYOUT */
@media (min-width: 992px) {
  .sticky-sidebar {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
}

.metadata-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border-color);
  border-radius: var(--bs-border-radius-lg);
}

.metadata-item {
  border-bottom: 1px solid var(--card-border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.metadata-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Classification values in the metadata sidebar are clickable links that jump
   to the incidents explorer filtered by that classification. */
.metadata-value-link {
  color: var(--bs-primary);
  text-decoration: none;
}

.metadata-value-link:hover,
.metadata-value-link:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--link-underline-color);
}

.policy-callout {
  border-left: 4px solid var(--bs-primary);
  background-color: var(--bs-tertiary-bg);
  border-radius: 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.policy-callout:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.policy-callout-gap {
  border-left-color: var(--bs-warning);
}

.policy-callout-regulation {
  border-left-color: var(--bs-info);
}

/* External HTML tooltip (Chart.js plugin.tooltip.external) */
#chartjs-tooltip {
  opacity: 0;
  position: absolute;
  background: rgba(33, 37, 41, 0.96);
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: "Manrope", sans-serif;
  font-size: 0.8rem;
  line-height: 1.35;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 1080;
  max-width: 280px;
  transform: translate(-50%, 0);
}
#chartjs-tooltip.above { transform: translate(-50%, -100%); }
#chartjs-tooltip.below,
#chartjs-tooltip.no-transform { transform: translate(-50%, 0); }
#chartjs-tooltip table { margin: 0; }
#chartjs-tooltip th { font-weight: 700; padding-bottom: 2px; text-align: left; }
#chartjs-tooltip td { padding: 2px 0; }
#chartjs-tooltip td span {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.archive-pill { display: inline-block; }
.archive-pill a, .archive-pill a:hover { text-decoration: none; }
.archive-save-btn { cursor: pointer; }
.archive-save-btn:disabled { cursor: default; opacity: 0.85; }





