/* Hide parent theme's default headline for legal blog template */
.legal-blog-single .btPageHeadline,
.legal-blog-single .btHeadline,
.legal-blog-single .btPageHeadlineContent {
  display: none !important;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #181818;
  --muted: #413c40;
  --brand: #265c73;
  /* teal */
  --brand-2: #c8d907;
  /* lime accent */
  --line: #edeef0;
  --radius: 12px;
  --gap: 22px;
  --shadow: none;
  --content-w: 1280px;
  --side-w: 340px;
  --toc-w: 280px;
}

html,
body {
  height: 100%
}

body {
  background: var(--bg);
  color: var(--ink);
  /* Subtle gradient background */
  background: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
  background-attachment: fixed;
}

.wrap {
  max-width: var(--content-w);
  margin: auto;
  padding: 28px 20px
}

.hero {
  display: grid;
  grid-template-columns: 1fr min(40%, var(--side-w));
  gap: var(--gap);
  margin-top: 24px;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title {
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.15;
  margin: 4px 0 12px
}

.subtitle {
  color: var(--muted)
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 18px
}

.chip {
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
  background: linear-gradient(135deg, #ffffff, #f9fafb);
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--brand);
  background: linear-gradient(135deg, rgba(38, 92, 115, 0.05), rgba(200, 217, 7, 0.02));
  transform: translateY(-1px);
}

.summary {
  background: linear-gradient(135deg, #f7faff, #ffffff);
  border-left: 4px solid var(--brand);
  padding: 18px 20px;
  border-radius: 0 8px 8px 0;
  position: relative;
  overflow: hidden;
}

.summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: var(--gap);
  overflow: visible;
}

/* Ensure no ancestor breaks sticky */
.legal-blog-single,
.legal-blog-single .grid,
.legal-blog-single .right-rail {
  overflow: visible !important;
}

/* Parent theme containers can clip sticky; open them up on this template */
body.post-template-single-legal-blog .btPageWrap,
body.post-template-single-legal-blog .btContentWrap,
body.post-template-single-legal-blog .btContentHolder {
  overflow: visible !important;
  transform: none !important;
}

.article {
  display: grid;
  gap: 32px
}

.right-rail {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  align-self: stretch;
  min-height: 100%;
}

/* Unstick individual widgets; the wrapper handles it */
.legal-blog-single .cta-sidebar-widget {
  position: static;
  top: auto;
}

.toc {
  position: sticky;
  top: 86px;
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  background: transparent;
  margin-top: 0;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.toc::-webkit-scrollbar {
  width: 6px;
}

.toc::-webkit-scrollbar-track {
  background: transparent;
}

.toc::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.toc::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

.admin-bar .toc {
  top: 150px;
}

.toc h3 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.toc a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.2s ease;
  position: relative;
  font-size: 14px;
}

.toc a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--brand);
  transition: height 0.2s ease;
  border-radius: 0 2px 2px 0;
}

.toc a.active {
  color: var(--brand);
  font-weight: 600;
  background: linear-gradient(90deg, rgba(38, 92, 115, 0.08), transparent);
}

.toc a.active::before {
  height: 20px;
}

.toc a:hover {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(38, 92, 115, 0.05), transparent);
  transform: translateX(2px);
}

.table {
  overflow: auto
}

table {
  width: 100%;
  border-collapse: collapse
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f6f8fc
}

tr:hover td {
  background: #fafcff
}

.legal-blog-single a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-blog-single a:hover {
  text-decoration: underline;
  color: color-mix(in srgb, var(--brand) 80%, black);
}

/* ========================================
   LAYOUT ENHANCEMENTS
   ======================================== */

/* Content Loading Animation */
.content-loading {
  position: relative;
  overflow: hidden;
}

.content-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Skeleton Loading States */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Improved Focus Styles */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Container Query Support (for modern browsers) */
@container (max-width: 768px) {
  .article {
    font-size: 16px;
  }
}

/* Performance Optimizations */
.will-transform {
  will-change: transform;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
  /* Dark mode variables can be added here */
}

/* Print Optimizations */
@media print {
  body {
    background: white;
  }

  .toc,
  .right-rail {
    display: none;
  }

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

  .article {
    max-width: 100%;
  }
}