html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  width: 100%;
  position: relative;
  background-color: var(--color-bg, #0b1121);
  color: var(--color-ink, #f1f5f9);
  font-family: var(--font-sans, 'Inter', system-ui, Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
}

/* Official Lenis v1 CSS recommendations for 60fps jitter-free scrolling */
html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* Hardware-accelerated fixed header & sticky elements */
header.fixed,
#sticky-subnav {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

/* Ensure sticky sidebars have correct positioning and stay sticky during scrolling */
@media (min-width: 1024px) {
  aside.lg\:sticky,
  aside.sticky {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 6rem !important; /* 96px */
    align-self: flex-start !important;
  }
}
@media (min-width: 1280px) {
  aside.xl\:sticky {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 6rem !important;
    align-self: flex-start !important;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  header.fixed, #sticky-subnav {
    background-color: #0b1121 !important;
  }
}

/* Prevent AOS off-screen horizontal translations from causing mobile page scrolling */
@media screen and (max-width: 768px) {
  [data-aos="fade-left"],
  [data-aos="fade-right"] {
    transform: translate3d(0, 20px, 0) !important;
  }
  [data-aos] {
    max-width: 100% !important;
    overflow-x: clip !important;
  }
}

/* Operational Grid Decorator (Subdued, GPU-accelerated layer) */
.grid-bg {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--color-border, #334155) 1px, transparent 1px), linear-gradient(90deg, var(--color-border, #334155) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: .05;
  pointer-events: none;
  transform: translateZ(0);
}

/* Kickers / Small Labels */
.kicker {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--color-muted, #94a3b8);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kicker::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--color-muted-2, #64748b);
}

/* Status Dot Indicator */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
.status-success { background-color: var(--color-success, #22c55e); box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.status-warning { background-color: var(--color-warning, #eab308); box-shadow: 0 0 8px rgba(234, 179, 8, 0.4); }
.status-danger { background-color: var(--color-danger, #ef4444); box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
.status-active { background-color: var(--color-primary, #3b82f6); box-shadow: 0 0 8px rgba(59, 130, 246, 0.4); }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading, 'Inter', system-ui, Arial, sans-serif);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  margin: 12px 0 16px;
}
h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.lead { color: var(--color-muted, #94a3b8); font-size: 16px; max-width: 700px; line-height: 1.6; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 6px;
  transition: all .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-sans, 'Inter', system-ui, Arial, sans-serif);
}
.btn-primary {
  background: var(--color-primary, #3b82f6);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--color-primary-dark, #2563eb);
}
.btn-ghost {
  background: transparent;
  color: var(--color-ink, #f1f5f9);
  border-color: var(--color-border, #334155);
}
.btn-ghost:hover {
  border-color: var(--color-muted-2, #64748b);
  background: rgba(255, 255, 255, 0.05);
}

/* Modern Operational Panels & Cards */
.panel { 
  background: var(--color-surface, #151e32);
  border: 1px solid var(--color-border, #334155);
  border-radius: 10px;
  transition: all 0.2s ease;
}
.panel:hover {
  border-color: var(--color-muted-2, #64748b);
}

/* Clean Card */
.card {
  background: var(--color-surface, #151e32);
  border: 1px solid var(--color-border, #334155);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.card:hover {
  border-color: var(--color-primary, #3b82f6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Data / Telemetry blocks */
.data-label {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  color: var(--color-muted-2, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-value {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  color: var(--color-ink, #f1f5f9);
  font-weight: 500;
}

/* Render performance & Hardware Acceleration */
.will-change-transform {
  will-change: transform;
}

/* ============================================================
   Dark Mode Form Controls & Select Options
   ============================================================ */
select {
  color-scheme: dark;
}

select option {
  background-color: #0b1121 !important;
  color: #f1f5f9 !important;
}

select option:disabled {
  color: #64748b !important;
  background-color: #0b1121 !important;
}

/* ============================================================
   Editorial Typography & CKEditor Prose Enhancement
   Tự động biến nội dung CKEditor thành bài viết chuẩn tạp chí công nghệ
   ============================================================ */
.article-prose {
  color: rgba(241, 245, 249, 0.85);
  font-size: 1.0625rem;
  line-height: 1.85;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* Paragraph spacing & reading comfort */
.article-prose p {
  margin-bottom: 1.5rem;
  color: rgba(241, 245, 249, 0.82);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* First lead paragraph */
.article-prose > p:first-of-type {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.85;
  font-weight: 400;
}

/* Section Headings H2 (Block display with solid accent border to allow natural multi-line wrapping on mobile) */
.article-prose h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.4;
  letter-spacing: -0.02em;
  display: block;
  position: relative;
  padding-left: 0.875rem;
  border-left: 4px solid #3b82f6;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .article-prose h2 {
    font-size: 1.625rem;
    padding-left: 1rem;
  }
}

/* Section Headings H3 */
.article-prose h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 2rem;
  margin-bottom: 0.875rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .article-prose h3 {
    font-size: 1.25rem;
  }
}

/* Section Headings H4 */
.article-prose h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #93c5fd;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Links */
.article-prose a {
  color: #60a5fa;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: all 0.2s ease;
}

.article-prose a:hover {
  color: #93c5fd;
  text-decoration-color: #93c5fd;
}

/* Enhanced Blockquote: Tech Quote Card */
.article-prose blockquote {
  position: relative;
  margin: 2.25rem 0;
  padding: 1.5rem 1.75rem 1.5rem 2.25rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-left: 4px solid #3b82f6;
  border-radius: 1rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}

.article-prose blockquote::before {
  content: '“';
  position: absolute;
  top: -0.4rem;
  left: 0.6rem;
  font-size: 3.5rem;
  line-height: 1;
  font-family: Georgia, serif;
  color: rgba(59, 130, 246, 0.3);
  pointer-events: none;
}

.article-prose blockquote p {
  color: #e2e8f0;
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.75;
  margin: 0;
}

/* Bullet Lists */
.article-prose ul {
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-prose ul > li {
  position: relative;
  padding-left: 1.75rem;
  color: rgba(241, 245, 249, 0.8);
  line-height: 1.65;
}

.article-prose ul > li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.6em;
  width: 7px;
  height: 7px;
  background-color: #3b82f6;
  border-radius: 9999px;
  box-shadow: 0 0 8px #3b82f6;
}

/* Numbered Lists */
.article-prose ol {
  counter-reset: custom-counter;
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-prose ol > li {
  position: relative;
  padding-left: 2.25rem;
  color: rgba(241, 245, 249, 0.8);
  line-height: 1.65;
}

.article-prose ol > li::before {
  counter-increment: custom-counter;
  content: counter(custom-counter);
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 22px;
  height: 22px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Table Wrapper & Responsive Scroll */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  -webkit-overflow-scrolling: touch;
}

/* Tables (from CKEditor) */
.article-prose table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  border: none;
  font-size: 0.9375rem;
  background: transparent;
}

.article-prose table th {
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  font-weight: 700;
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.9);
  border-top: none;
  border-left: none;
  border-right: none;
  letter-spacing: 0.02em;
}

.article-prose table td {
  padding: 0.875rem 1rem;
  color: rgba(241, 245, 249, 0.75);
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  line-height: 1.6;
}

.article-prose table tr:last-child td {
  border-bottom: none;
}

.article-prose table tr:nth-child(even) td {
  background: rgba(30, 41, 59, 0.25);
}

.article-prose table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

/* Images & Figures from CKEditor */
.article-prose img {
  border-radius: 1rem;
  border: 1px solid rgba(51, 65, 85, 0.6);
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.6);
  margin: 2rem auto;
  max-width: 100%;
  height: auto;
  display: block;
}

.article-prose figure {
  margin: 2rem 0;
  text-align: center;
}

.article-prose figcaption {
  font-size: 0.8125rem;
  color: rgba(148, 163, 184, 0.8);
  margin-top: 0.625rem;
  font-style: italic;
}

/* Horizontal Rule Divider */
.article-prose hr {
  margin: 3rem 0;
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(59, 130, 246, 0.4), rgba(6, 182, 212, 0.4), transparent);
  position: relative;
}

.article-prose hr::after {
  content: '✦';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #0b1121;
  padding: 0 0.75rem;
  color: #3b82f6;
  font-size: 0.875rem;
}

/* Inline Code */
.article-prose code {
  background: rgba(30, 41, 59, 0.8);
  color: #93c5fd;
  font-family: var(--font-mono, monospace);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Print Styles for Legal and Documentation Pages */
@media print {
  @page {
    size: A4 portrait;
    margin: 18mm 15mm 18mm 15mm;
  }

  /* Force hide all screen chrome, navigation, widgets, and sidebars */
  header, 
  footer, 
  aside, 
  nav,
  #back-to-top,
  #legal-mobile-toc-container, 
  #legal-back-to-top, 
  .qc-bar-widget,
  .no-print,
  [no-print],
  .grid-bg,
  [role="dialog"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Reset layout structure for paper flow */
  html, body {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
    line-height: 1.6 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  section {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
  }

  /* Unset grid so main spans full page width */
  .grid,
  .lg\:grid-cols-12,
  .grid-cols-1 {
    display: block !important;
    width: 100% !important;
  }

  main, 
  article,
  main.col-span-12,
  article.col-span-12,
  .col-span-12, 
  .xl\:col-span-6, 
  .lg\:col-span-6,
  .lg\:col-span-8 {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
  }

  /* Summary Card in Print */
  .mb-8.p-5 {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    margin-bottom: 1.5rem !important;
    padding: 1rem 1.25rem !important;
  }

  .mb-8.p-5 span,
  .mb-8.p-5 div,
  .mb-8.p-5 svg {
    color: #1e3a8a !important;
  }

  .mb-8.p-5 p {
    color: #334155 !important;
    font-size: 10pt !important;
    line-height: 1.5 !important;
  }

  /* Document Body Container */
  #legal-content-body {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    color: #0f172a !important;
  }

  /* Prose typography in print */
  .article-prose {
    font-size: 10.5pt !important;
  }

  .article-prose h2 {
    color: #0f172a !important;
    font-size: 15pt !important;
    font-weight: 800 !important;
    border-left: 3.5px solid #2563eb !important;
    padding-left: 0.6rem !important;
    margin-top: 1.75rem !important;
    margin-bottom: 0.75rem !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .article-prose h3 {
    color: #1e293b !important;
    font-size: 12.5pt !important;
    font-weight: 700 !important;
    margin-top: 1.25rem !important;
    margin-bottom: 0.5rem !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .article-prose h4 {
    color: #334155 !important;
    font-size: 11pt !important;
    font-weight: 700 !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .article-prose p {
    color: #334155 !important;
    font-size: 10.5pt !important;
    line-height: 1.65 !important;
    margin-bottom: 0.875rem !important;
    orphans: 3;
    widows: 3;
  }

  .article-prose ul > li, 
  .article-prose ol > li {
    color: #334155 !important;
    font-size: 10.5pt !important;
    line-height: 1.55 !important;
  }

  .article-prose ul > li::before {
    background-color: #2563eb !important;
    box-shadow: none !important;
  }

  .article-prose ol > li::before {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
  }

  .article-prose blockquote {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 4px solid #2563eb !important;
    box-shadow: none !important;
    color: #1e293b !important;
    padding: 1rem 1.25rem !important;
    margin: 1.25rem 0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .article-prose blockquote p {
    color: #1e293b !important;
    font-style: italic !important;
  }

  /* Printable Table Formatting */
  .table-responsive-wrapper {
    border: 1px solid #cbd5e1 !important;
    background: transparent !important;
    margin: 1.25rem 0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .article-prose table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-size: 9.5pt !important;
  }

  .article-prose table td {
    color: #334155 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    font-size: 9pt !important;
  }

  .article-prose table tr:nth-child(even) td {
    background: #f8fafc !important;
  }

  /* Footnote / Signature block */
  .mt-8.p-6 {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    page-break-inside: avoid;
    break-inside: avoid;
    margin-top: 2rem !important;
  }

  .mt-8.p-6 span,
  .mt-8.p-6 div {
    color: #475569 !important;
  }
}

/* Hide uninitialized Alpine components immediately upon render */
[x-cloak] {
  display: none !important;
}

@media (max-width: 1023px) {
  /* Ensure mobile nav is hidden by default prior to Alpine or when closed */
  header nav[x-cloak],
  header nav:not([class*="max-lg:flex"]) {
    display: none !important;
  }
}

