/* Enhancements for legacy legal templates in the new theme */
.fv-legacy-legal {
  background: #080716;
}

.fv-legacy-legal .max-w-7xl.grid {
  align-items: stretch !important;
}

/* Sticky sidebar fallback (apply sticky to ASIDE for stronger cross-browser behavior) */
.fv-legacy-legal aside {
  position: static !important;
  top: auto !important;
  align-self: stretch !important;
  height: auto !important;
  overflow: visible !important;
}

/* stickybits requires a positioned parent */
.fv-legacy-legal aside.js-stickybit-parent {
  position: relative !important;
}

/* Hard fallback states when sticky cannot latch in browser/layout */
.fv-legacy-legal aside nav.fv-manual-fixed {
  position: fixed !important;
  top: 10px !important;
  z-index: 30 !important;
}

.fv-legacy-legal aside nav.fv-manual-bottom {
  position: absolute !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
}

.fv-legacy-legal aside nav {
  position: relative;
  max-height: none;
  overflow: visible;
  padding-top: 0;
  padding-bottom: 0;
}

/* Ensure sticky nav works even if utility CSS is missing/overridden */
.fv-legacy-legal aside nav.sticky {
  top: 10px;
  max-height: none;
  overflow: visible;
}

/* Active state for TOC links (fallback when Alpine bindings are not active) */
.fv-legacy-legal aside nav a.fv-legacy-active {
  color: #37b594 !important;
  border-left: 2px solid #37b594 !important;
  background: rgba(55, 181, 148, 0.1) !important;
}

/* Teal info callouts */
.fv-legacy-legal [class*="border-teal-green/20"][class*="border-l-2"][class*="border-l-teal-green"][class*="bg-deep-teal/50"] {
  border: 1px solid color-mix(in oklab, var(--color-teal-green) 20%, transparent) !important;
  border-left-width: 2px !important;
  border-left-color: var(--color-teal-green) !important;
}

/* Generic teal panels with /15 border token */
.fv-legacy-legal [class*="border-teal-green/15"] {
  border-color: color-mix(in oklab, var(--color-teal-green) 15%, transparent) !important;
}

/* Teal badges with /35 border token */
.fv-legacy-legal [class*="border-teal-green/35"] {
  border-color: color-mix(in oklab, var(--color-teal-green) 35%, transparent) !important;
}

/* Burnt-sienna warning callouts */
.fv-legacy-legal [class*="border-burnt-sienna/25"][class*="border-l-\\[3px\\]"][class*="border-l-burnt-sienna"] {
  border-top: 1px solid color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
  border-right: 1px solid color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
  border-bottom: 1px solid color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
  border-left: 2px solid var(--color-burnt-sienna) !important;
  background: color-mix(in oklab, var(--color-burnt-sienna) 7.000000000000001%, transparent) !important;
}

/* Strong class-based fallback to prevent white borders on burnt callouts */
.fv-legacy-legal .border-burnt-sienna\/25 {
  border-color: color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
}

.fv-legacy-legal .border-l-burnt-sienna {
  border-left-color: var(--color-burnt-sienna) !important;
}

.fv-legacy-legal .border-l-\[3px\].border-l-burnt-sienna {
  border-left-width: 2px !important;
}

/* Burnt-sienna chips/pills: uniform border on all sides */
.fv-legacy-legal [class*="bg-burnt-sienna/10"][class*="border-burnt-sienna/25"] {
  border: 1px solid color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
  border-color: color-mix(in oklab, var(--color-burnt-sienna) 25%, transparent) !important;
}

/* Teal action buttons with /30 border token */
.fv-legacy-legal [class*="border-teal-green/30"] {
  border-color: color-mix(in oklab, var(--color-teal-green) 30%, transparent) !important;
}

/* Legacy table palette fixes */
.fv-legacy-legal [class*="bg-teal-green/[0.08]"] {
  background: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

.fv-legacy-legal [class*="border-teal-green/20"] {
  border-color: color-mix(in oklab, var(--color-teal-green) 20%, transparent) !important;
}

.fv-legacy-legal [class*="divide-teal-green/[0.08]"] > * + * {
  border-color: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

/* Remove white vertical separators in table headers */
.fv-legacy-legal tr th:not(:first-child) {
  border-left: 1px solid transparent !important;
}

/* Ensure table headers use the teal 8% mixed background */
.fv-legacy-legal thead tr {
  background-color: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

/* Body rows must stay transparent */
.fv-legacy-legal tbody tr {
  background: transparent !important;
}

/* Explicit divider rule requested for teal 0.08 groups */
.fv-legacy-legal :where([class*="divide-teal-green/[0.08]"] > :not(:last-child)) {
  border-color: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

/* Direct table selectors to ensure legacy templates render exactly */
.fv-legacy-legal thead tr.bg-teal-green\/\[0\.08\] {
  background-color: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

.fv-legacy-legal thead tr.bg-teal-green\/\[0\.08\] > th,
.fv-legacy-legal thead tr[class*="bg-teal-green/"] > th {
  background-color: color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}

.fv-legacy-legal tbody.divide-y.divide-teal-green\/\[0\.08\] > tr + tr {
  border-top: 1px solid color-mix(in oklab, var(--color-teal-green) 8%, transparent) !important;
}
