/* =========================================
   LGBTQ+ Bar Guide – Base Tokens
   ========================================= */
:root {
  /* Typography */
  --lgb-font-family:
    system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --lgb-font-size: 14px;
  --lgb-line-height: 1;

  /* Spacing */
  --lgb-space-1: 4px;
  --lgb-space-2: 8px;
  --lgb-space-3: 12px;
  --lgb-space-4: 16px;

  /* Radius & borders */
  --lgb-radius: 8px;
  --lgb-border-width: 1px;

  /* Color (light defaults) */
  --lgb-primary: #00839c;
  --lgb-bg: #ffffff;
  --lgb-surface: #ffffff;
  --lgb-surface-2: #f7f7f8;
  --lgb-text: #111827;
  --lgb-muted: #6b7280;
  --lgb-border: #e5e7eb;
  --lgb-link: #00839c;
  --lgb-tooltip-bg: var(--lgb-surface);
  --lgb-tooltip-border: var(--lgb-border);
  --lgb-tooltip-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
  --lgb-tooltip-maxw: 420px;

  /* Table */
  --lgb-cell-padding-y: 10px;
  --lgb-cell-padding-x: 12px;
  --lgb-header-bg: var(--lgb-surface-2);
  --lgb-row-hover: rgba(17, 24, 39, 0.04);
  --lgb-row-zebra: rgba(17, 24, 39, 0.02);

  /* Sticky */
  --lgb-sticky-shadow: 0 0 0 rgba(0, 0, 0, 0);
  --lgb-sticky-divider: var(--lgb-border);

  /* Scrollbar */
  --lgb-scrollbar-size: 10px;
}

/* Optional: dark mode via system preference */
/* @media (prefers-color-scheme: dark) {
  :root {
    --lgb-bg: #0b0f19;
    --lgb-surface: #0f1629;
    --lgb-surface-2: #111b33;
    --lgb-text: #e5e7eb;
    --lgb-muted: #9ca3af;
    --lgb-border: #24304f;
    --lgb-link: #7aa7ff;
    --lgb-row-hover: rgba(229, 231, 235, 0.06);
    --lgb-row-zebra: rgba(229, 231, 235, 0.03);
  }
} */

/* Optional: explicit theme override hook */
[data-lgb-theme="light"] {
  color-scheme: light;
}
[data-lgb-theme="dark"] {
  color-scheme: dark;
}
.site-submenu {
  display: none !important;
}
/* =========================================
   Grid Component
   ========================================= */
.lgbtqbar-grid {
  font-family: var(--lgb-font-family);
  font-size: var(--lgb-font-size);
  line-height: var(--lgb-line-height);
  color: var(--lgb-text);
  max-width: 100%;
}

.lgbtqbar-grid__status {
  display: flex;
  align-items: center;
  gap: var(--lgb-space-2);
  margin-bottom: var(--lgb-space-3);
  padding: var(--lgb-space-2) var(--lgb-space-3);
  background: var(--lgb-surface-2);
  border: var(--lgb-border-width) solid var(--lgb-border);
  border-radius: var(--lgb-radius);
  color: var(--lgb-text);
}

.lgbtqbar-grid__status-label {
  font-weight: 600;
}

.lgbtqbar-grid__status-value {
  color: var(--lgb-muted);
}

.lgbtqbar-grid__hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--lgb-space-2);
  margin-bottom: var(--lgb-space-3);
  padding: var(--lgb-space-2) var(--lgb-space-3);
  background: var(--lgb-surface-2);
  border: var(--lgb-border-width) solid var(--lgb-border);
  border-radius: var(--lgb-radius);
  color: var(--lgb-text);
}

.lgbtqbar-grid__hint-icon {
  color: var(--lgb-link);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lgbtqbar-grid__hint-text {
  font-weight: 500;
}

.lgbtqbar-grid__hint-subtext {
  color: var(--lgb-muted);
  font-size: 0.92em;
}

/* Scroll container */
.lgbtqbar-grid__scroll {
  overflow: auto;
  max-height: 70vh;
  background: var(--lgb-surface);
  border: var(--lgb-border-width) solid var(--lgb-border);
  border-radius: var(--lgb-radius);
}

/* If you use contained mode, you can enforce height in CSS using a class.
   (You already output data-contained-height; you could later map that with JS.)
*/
.lgbtqbar-grid--contained .lgbtqbar-grid__scroll {
  max-height: 60vh; /* default; can be overridden per page with custom CSS */
}

/* Table base */
.lgbtqbar-grid__table {
  width: max-content; /* allow horizontal scroll */
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  line-height: var(--lgb-line-height);
}

/* Header */
.lgbtqbar-grid__table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--lgb-header-bg);
  text-align: left;
  font-weight: 600;
  color: var(--lgb-text);
  border-bottom: var(--lgb-border-width) solid var(--lgb-border);
  padding: var(--lgb-cell-padding-y) var(--lgb-cell-padding-x);
  white-space: normal;
  max-width: 200px;
}

/* Body cells */
.lgbtqbar-grid__table tbody th,
.lgbtqbar-grid__table tbody td {
  padding: var(--lgb-cell-padding-y) var(--lgb-cell-padding-x);
  border-bottom: var(--lgb-border-width) solid var(--lgb-border);
  vertical-align: top;
  max-width: 250px;
}

/* Zebra + hover */
.lgbtqbar-grid__table tbody tr:nth-child(even) td,
.lgbtqbar-grid__table tbody tr:nth-child(even) th {
  background: var(--lgb-row-zebra);
}

.lgbtqbar-grid__table tbody tr:hover td,
.lgbtqbar-grid__table tbody tr:hover th {
  background: var(--lgb-row-hover);
}

/* Links */
.lgbtqbar-grid a {
  color: var(--lgb-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lgbtqbar-grid a:hover {
  text-decoration-thickness: 2px;
}

/* Empty values */
.lgbtqbar-grid__empty {
  color: var(--lgb-muted);
}

/* Sticky first column (disabled for now)

.lgbtqbar-grid--sticky-first-col .lgbtqbar-grid__table tbody th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--lgb-surface);
}

.lgbtqbar-grid--sticky-first-col .lgbtqbar-grid__table thead th:first-child {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  background: var(--lgb-header-bg);
}

.lgbtqbar-grid--sticky-first-col .lgbtqbar-grid__table thead th:first-child,
.lgbtqbar-grid--sticky-first-col .lgbtqbar-grid__table tbody th[scope="row"] {
  box-shadow: 1px 0 0 var(--lgb-sticky-divider);
}

*/

/* Scrollbar styling (WebKit) */
.lgbtqbar-grid__scroll::-webkit-scrollbar {
  height: var(--lgb-scrollbar-size);
  width: var(--lgb-scrollbar-size);
}
.lgbtqbar-grid__scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--lgb-muted) 35%, transparent);
  border-radius: 999px;
}
.lgbtqbar-grid__scroll::-webkit-scrollbar-track {
  background: transparent;
}

.lgbtqbar-tooltip {
  position: relative;
  display: inline-block;
}

.lgbtqbar-tooltip__trigger {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--lgb-link);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.lgbtqbar-tooltip__panel {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: var(--lgb-space-2);
  z-index: 20;
  display: none;
  max-width: var(--lgb-tooltip-maxw);
  min-width: 240px;
  background: var(--lgb-tooltip-bg);
  border: var(--lgb-border-width) solid var(--lgb-tooltip-border);
  border-radius: var(--lgb-radius);
  box-shadow: var(--lgb-tooltip-shadow);
  padding: var(--lgb-space-3);
  color: var(--lgb-text);
  white-space: normal;
  overflow-wrap: anywhere;
}
.lgbtqbar-grid__header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
  gap: var(--lgb-space-4);
  margin-bottom: var(--lgb-space-4);
}

.lgbtqbar-grid__header > .lgbtqbar-grid__status,
.lgbtqbar-grid__header > .lgbtqbar-grid__hint {
  height: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
}
@media (max-width: 800px) {
  .lgbtqbar-grid__header {
    grid-template-columns: 1fr;
    gap: var(--lgb-space-3);
  }
}
.lgbtqbar-tooltip:hover .lgbtqbar-tooltip__panel,
.lgbtqbar-tooltip:focus-within .lgbtqbar-tooltip__panel {
  display: block;
}
.lgbtqbar-jurisdiction {
  margin-top: var(--lgb-space-4);
}
/* Targeted fields */
.lgbtqbar-grid__col--jurisdiction {
  background-color: var(--lgb-surface) !important;
  text-align: left;
  min-height: 0;
}
/* Single Bar Jurisdiction */
.lgbtqbar-jurisdiction__label {
  font-weight: 600;
  color: var(--lgb-text);
}
.lgbtqbar-jurisdiction__value {
  color: var(--lgb-muted);
}
.lgbtqbar-jurisdiction__section-title {
  font-size: 1.5em;
  font-weight: 600;
  margin-block: var(--lgb-space-2);
  color: var(--lgb-text);
  background: color-mix(in srgb, var(--lgb-primary) 20%, white);
  padding: var(--lgb-space-2) var(--lgb-space-3);
}
.lgbtqbar-jurisdiction__toc-list {
  margin-top: var(--lgb-space-3);
  display: flex;
  gap: 1em;
}
.lgbtqbar-jurisdiction__toc-list > li {
  list-style: none;
}
.lgbtqbar-jurisdiction__field {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--lgb-space-3);
  padding: var(--lgb-space-3);
}
.lgbtqbar-jurisdiction__field:nth-child(odd) {
  background: var(--lgb-surface-2);
}
.lgbtqbar-jurisdiction__field--long {
  display: block;
}
.lgbtqbar-jurisdiction__field--long .lgbtqbar-jurisdiction__label {
  margin-bottom: var(--lgb-space-2);
}
.lgbtqbar-jurisdiction__field:not(.lgbtqbar-jurisdiction__field--long) p {
  margin-block: 0;
}

.lgbtqbar-jurisdiction__layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: var(--lgb-space-4);
  align-items: start;
}

.lgbtqbar-jurisdiction__main {
  min-width: 0;
}

.lgbtqbar-jurisdiction__sidebar {
  background: var(--lgb-surface-2);
  border: var(--lgb-border-width) solid var(--lgb-border);
  border-radius: var(--lgb-radius);
  padding: var(--lgb-space-3);
}

.lgbtqbar-jurisdiction__sidebar-title {
  margin: 0 0 var(--lgb-space-3);
  font-size: 1.1em;
  font-weight: 600;
  color: var(--lgb-text);
}

.lgbtqbar-jurisdiction__sidebar-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lgbtqbar-jurisdiction__sidebar-item + .lgbtqbar-jurisdiction__sidebar-item {
  margin-top: var(--lgb-space-1);
}

.lgbtqbar-jurisdiction__sidebar-link {
  display: block;
  padding: var(--lgb-space-1) var(--lgb-space-3);
  border-radius: var(--lgb-radius);
  color: var(--lgb-link);
  text-decoration: none;
}

.lgbtqbar-jurisdiction__sidebar-link:hover,
.lgbtqbar-jurisdiction__sidebar-link:focus {
  background: var(--lgb-surface);
  text-decoration: underline;
}

.lgbtqbar-jurisdiction__sidebar-link--active {
  background: var(--lgb-surface);
  color: var(--lgb-text);
  font-weight: 600;
}

@media (max-width: 900px) {
  .lgbtqbar-jurisdiction__layout {
    grid-template-columns: 1fr;
  }
}
