/* ═══════════════════════════════════════════════════════════════
   ALBOWA — Legal & Compliance Governance Stylesheet
   Shared across Terms of Service and Privacy Policy
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. Legal Hero Adjustments ─── */
.page-hero--legal {
  min-height: auto;
  padding-top: clamp(110px, 14vh, 140px);
  padding-bottom: clamp(40px, 6vh, 60px);
}

.legal-meta-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.legal-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.legal-meta-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

/* ─── 2. Legal Document Layout ─── */
.legal-section {
  position: relative;
  padding: clamp(30px, 5vh, 60px) 0 clamp(60px, 8vh, 100px);
  background: var(--color-bg);
}

.legal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(24px, 3.5vw, 48px);
  align-items: start;
}

/* ─── 3. Sticky Quick-Jump Sidebar ─── */
.legal-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 92px;
  align-self: start;
  height: calc(100vh - 128px);
  max-height: calc(100vh - 120px);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: clamp(20px, 2.5vh, 26px) 18px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.03);
  z-index: 10;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.2) transparent;
}

.legal-sidebar::-webkit-scrollbar {
  width: 4px;
}

.legal-sidebar::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.2);
  border-radius: 4px;
}

.legal-sidebar__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: clamp(10px, 1.4vh, 16px);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.legal-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.legal-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
  gap: 2px;
}

.legal-nav-list li {
  display: flex;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.legal-nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(6px, 1vh, 9px) 12px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1.35;
  box-sizing: border-box;
}

.legal-nav-link__num,
.legal-nav-num {
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-accent);
  opacity: 0.8;
  flex-shrink: 0;
}

.legal-nav-link:hover {
  background: rgba(37, 99, 235, 0.05);
  color: var(--color-text-primary);
  transform: translateX(2px);
}

.legal-nav-link.is-active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-accent);
  font-weight: 600;
}

/* ─── 4. Document Article Container ─── */
.legal-article {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.04);
}

.legal-clause {
  margin-bottom: clamp(32px, 5vh, 48px);
  padding-bottom: clamp(24px, 4vh, 36px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  scroll-margin-top: 100px;
}

.legal-clause:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.legal-clause__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.legal-clause__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.legal-clause__title {
  font-size: clamp(1.15rem, 1.6vw, 1.35rem);
  font-weight: 750;
  color: var(--color-text-primary);
  letter-spacing: -0.015em;
  margin: 0;
}

.legal-clause p {
  font-size: 0.94rem;
  line-height: 1.72;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
}

.legal-clause p:last-child {
  margin-bottom: 0;
}

.legal-clause ul {
  margin: 14px 0 18px 20px;
  padding: 0;
  color: var(--color-text-secondary);
}

.legal-clause li {
  font-size: 0.92rem;
  line-height: 1.68;
  margin-bottom: 8px;
}

.legal-clause strong {
  color: var(--color-text-primary);
  font-weight: 650;
}

/* ─── 5. Specialized Callout Boxes ─── */
.legal-callout {
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(37, 99, 235, 0.04);
  border-left: 3px solid var(--color-accent);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.legal-callout--success {
  background: rgba(16, 185, 129, 0.04);
  border-left-color: #10B981;
}

.legal-callout__icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-accent);
}

.legal-callout--success .legal-callout__icon {
  color: #10B981;
}

.legal-callout__content {
  font-size: 0.88rem;
  line-height: 1.58;
  color: var(--color-text-secondary);
}

.legal-callout__content strong {
  color: var(--color-text-primary);
}

/* ─── 6. Mobile Responsiveness: Clean Document Layout & Hidden Overview ─── */
@media (max-width: 900px) {
  /* Completely hide left side overview on mobile view */
  .legal-sidebar {
    display: none !important;
  }

  /* Make layout a clean, full-width block */
  .legal-layout {
    display: block !important;
    width: 100% !important;
    gap: 0 !important;
  }

  /* Mobile container: transparent flex column hosting individual section boxes */
  .legal-article {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .legal-section {
    padding-top: 16px !important;
    padding-bottom: clamp(48px, 8vh, 80px) !important;
    background: var(--color-bg) !important;
  }

  /* Each section has an individual box of its own on mobile view */
  .legal-clause {
    background: var(--color-bg-card) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-xl) !important;
    padding: clamp(22px, 4.5vw, 32px) clamp(18px, 4vw, 26px) !important;
    box-shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.035) !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--color-border) !important;
    scroll-margin-top: 80px;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .legal-clause:last-of-type {
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--color-border) !important;
    padding-bottom: clamp(22px, 4.5vw, 32px) !important;
  }

  /* Clause heading structure & badge box */
  .legal-clause__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
  }

  .legal-clause__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-accent);
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .legal-clause__title {
    font-size: clamp(1.12rem, 3.5vw, 1.25rem) !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    letter-spacing: -0.015em;
    color: var(--color-text-primary);
    margin: 0;
  }

  .legal-clause p {
    font-size: 0.94rem;
    line-height: 1.72;
    color: var(--color-text-secondary);
    margin-bottom: 14px;
  }

  .legal-clause ul {
    margin: 12px 0 16px 18px;
  }

  .legal-clause li {
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: 8px;
  }

  /* Callout box structure */
  .legal-callout {
    margin: 18px 0 !important;
    padding: 14px 16px !important;
    border-radius: var(--radius-lg) !important;
    background: rgba(37, 99, 235, 0.04) !important;
    border-left: 3px solid var(--color-accent) !important;
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .legal-callout--success {
    background: rgba(16, 185, 129, 0.04) !important;
    border-left-color: #10B981 !important;
  }

  /* Clean hero on mobile */
  .page-hero--legal {
    padding-top: calc(76px + env(safe-area-inset-top, 0px) + 16px) !important;
    padding-bottom: 24px !important;
  }

  .page-hero--legal .page-hero__title {
    font-size: clamp(1.85rem, 6.5vw, 2.35rem) !important;
    margin-bottom: 8px !important;
  }

  .page-hero--legal .page-hero__subtitle {
    font-size: 0.92rem !important;
    line-height: 1.52 !important;
    margin-bottom: 12px !important;
  }

  .legal-meta-strip {
    margin-top: 10px !important;
    gap: 6px !important;
  }

  .legal-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: #FFFFFF;
    border: 1px solid var(--color-border);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
  }
}

/* ─── 7. Legal Page Scroll & Layout Overrides ─── */
/* Legal pages are document-reading layouts — they must scroll natively
   without any snap hijacking. These overrides counteract the global
   page-standalone rules in specs.css that assume section-based snap scrolling. */

/* Desktop & base: root document scroller configuration */
html:has(.legal-section),
html:has(body.page-legal),
body.page-legal,
body.page-standalone.page-legal {
  scroll-behavior: auto !important;
  overflow-x: clip !important;
  overflow-y: auto !important;
}

body.page-legal,
body.page-standalone.page-legal {
  overflow: visible !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  position: relative !important;
  min-height: 100vh;
}

/* Ensure no ancestor container traps or cancels position: sticky */
.legal-section,
.legal-section > .container,
.legal-layout {
  overflow: visible !important;
}

@media (max-width: 768px) {
  /* Compact hero — override the 100svh forced by body.page-standalone .page-hero */
  body.page-standalone .page-hero--legal,
  body.page-legal .page-hero--legal {
    min-height: auto !important;
    height: auto !important;
  }

  /* Ensure the legal body scrolls naturally on touch devices */
  html:has(.legal-section),
  html:has(.legal-section) body,
  body.page-legal,
  html:has(body.page-legal) {
    touch-action: pan-x pan-y !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
    scroll-behavior: auto !important;
  }

  /* Legal content sections must be free-flowing, not viewport-locked */
  body.page-standalone .legal-section,
  body.page-legal .legal-section {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.page-standalone .legal-section *,
  body.page-legal .legal-section * {
    touch-action: pan-x pan-y !important;
  }
}

/* ─── 8. Legal Navbar Scroll State ─── */
/* Transparent at the very top of the page when not scrolled */
body.page-legal .navbar:not(.is-scrolled):not(.is-menu-open),
body:has(.legal-section) .navbar:not(.is-scrolled):not(.is-menu-open) {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}

/* Premium frosted glassmorphism when scrolled down */
body.page-legal .navbar.is-scrolled,
body:has(.legal-section) .navbar.is-scrolled {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  box-shadow: 0 1px 0 var(--color-border) !important;
}

/* Solid frosted backdrop when mobile hamburger drawer is open */
body.page-legal .navbar.is-menu-open,
body:has(.legal-section) .navbar.is-menu-open {
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  box-shadow: 0 1px 0 var(--color-border) !important;
}