/* ─────────────────────────────────────────────────────────────────────────
   legal.css  —  shared stylesheet for Privacy Policy, Terms of Service,
                 and Cookie Policy pages
   ───────────────────────────────────────────────────────────────────────── */

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:        #002B5B;
  --primary-light:  #003f85;
  --secondary:      #455A64;
  --tertiary:       #00E5FF;
  --tertiary-dim:   rgba(0,229,255,0.15);
  --neutral:        #F8FAFC;
  --neutral-dark:   #E2E8F0;
  --text-dark:      #0F172A;
  --text-mid:       #334155;
  --text-light:     #64748B;
  --white:          #ffffff;
  --border:         #E2E8F0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,43,91,0.12);
  --radius:         12px;
  --transition:     0.3s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ─── Container ─── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ═══════════════════════════════════════════════════════
   NAV
══════════════════════════════════════════════════════════ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
}
.logo-badge {
  height: 38px;
  width: auto;
  display: block;
}
.logo-divider {
  width: 1px;
  height: 26px;
  background: rgba(255,255,255,0.22);
  margin: 0 12px;
  flex-shrink: 0;
}
.logo-words {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.logo-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 0.97rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
}
.logo-x { color: #3E8AE8; }
.logo-sub {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 0.57rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

/* Nav right */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.theme-toggle svg {
  width: 17px;
  height: 17px;
  transition: var(--transition);
}
/* show sun in dark mode, moon in light mode */
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Back to Home link */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  transition: var(--transition);
}
.nav-back:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.35);
}
.nav-back svg {
  width: 15px;
  height: 15px;
}

/* ═══════════════════════════════════════════════════════
   LEGAL HERO
══════════════════════════════════════════════════════════ */
.legal-hero {
  background: var(--primary);
  padding: 56px 0 52px;
  position: relative;
  overflow: hidden;
}
.legal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 120% at 80% 50%, rgba(0,229,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.legal-hero-inner {
  position: relative;
}
.legal-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tertiary);
  background: rgba(0,229,255,0.12);
  border: 1px solid rgba(0,229,255,0.25);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.legal-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
}
.legal-hero p {
  color: rgba(255,255,255,0.55);
  font-size: 0.92rem;
}
.legal-hero strong {
  color: rgba(255,255,255,0.75);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════════════════════ */
.legal-main {
  padding: 64px 0 100px;
}

.legal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════
   TABLE OF CONTENTS (sidebar)
══════════════════════════════════════════════════════════ */
.toc {
  position: sticky;
  top: 88px;           /* below nav */
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 24px 20px;
  background: var(--neutral);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toc-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 14px;
}

.toc-list {
  list-style: none;
  counter-reset: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list li { padding: 0; }

.toc-list a {
  display: block;
  font-size: 0.82rem;
  color: var(--text-light);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: var(--transition);
  line-height: 1.4;
}
.toc-list a:hover {
  color: var(--primary);
  background: rgba(0,43,91,0.05);
  border-left-color: var(--tertiary);
}
.toc-list a.active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(0,43,91,0.06);
  border-left-color: var(--tertiary);
}

/* ═══════════════════════════════════════════════════════
   LEGAL CONTENT
══════════════════════════════════════════════════════════ */
.legal-content {
  min-width: 0;  /* prevents grid blowout */
}

.legal-content section {
  padding-bottom: 48px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.legal-content section:last-of-type {
  border-bottom: none;
}

.legal-content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  padding-top: 4px;
}

.legal-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-top: 28px;
  margin-bottom: 10px;
}

.legal-content p {
  color: var(--text-mid);
  margin-bottom: 14px;
  font-size: 0.96rem;
}
.legal-content p:last-child { margin-bottom: 0; }

.legal-content ul,
.legal-content ol {
  padding-left: 20px;
  margin-bottom: 14px;
  color: var(--text-mid);
  font-size: 0.96rem;
}
.legal-content li {
  margin-bottom: 8px;
  line-height: 1.65;
}
.legal-content li:last-child { margin-bottom: 0; }

.legal-content a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.legal-content a:hover { color: var(--tertiary); text-decoration: none; }

.legal-content strong { color: var(--text-dark); font-weight: 600; }
.legal-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.83em;
  background: rgba(0,43,91,0.06);
  color: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0,43,91,0.1);
}

/* ─── Cookie / data tables ─── */
.cookie-table-wrapper {
  overflow-x: auto;
  margin: 20px 0 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cookie-table thead {
  background: var(--neutral);
}
.cookie-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cookie-table td {
  padding: 12px 16px;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}
.cookie-table tr:last-child td { border-bottom: none; }
.cookie-table tr:hover td { background: rgba(0,43,91,0.02); }
.cookie-table a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-table a:hover { color: var(--tertiary); text-decoration: none; }

/* Cookie type badges */
.cookie-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.cookie-tag.essential {
  background: rgba(0,43,91,0.08);
  color: var(--primary);
  border: 1px solid rgba(0,43,91,0.18);
}
.cookie-tag.analytics {
  background: rgba(0,229,255,0.1);
  color: #006e85;
  border: 1px solid rgba(0,229,255,0.3);
}
.cookie-tag.preference {
  background: rgba(69,90,100,0.1);
  color: var(--secondary);
  border: 1px solid rgba(69,90,100,0.25);
}

/* ─── Contact block ─── */
.contact-block {
  background: var(--neutral);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tertiary);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-top: 16px;
}
.contact-block p {
  margin-bottom: 8px;
  font-size: 0.94rem;
}
.contact-block p:last-child { margin-bottom: 0; }
.contact-block a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.contact-block a:hover { color: var(--tertiary); text-decoration: none; }

/* ─── Legal footer links (cross-links between legal pages) ─── */
.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.legal-footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: var(--transition);
  text-decoration: none !important;
}
.legal-footer-links a:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(0,43,91,0.04);
}

/* ═══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */
footer {
  background: var(--primary);
  padding: 24px 0;
}
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-copy {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
}
.footer-legal {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-legal a {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.3);
  transition: color var(--transition);
}
.footer-legal a:hover { color: rgba(255,255,255,0.7); }
.footer-cookie-pref {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: color var(--transition);
  font-family: 'Inter', sans-serif;
}
.footer-cookie-pref:hover { color: rgba(255,255,255,0.7); }

/* ═══════════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════════════ */
[data-theme="dark"] body {
  color: #E2E8F0;
  background: #0B1628;
}

[data-theme="dark"] .legal-main {
  background: #0B1628;
}

/* TOC */
[data-theme="dark"] .toc {
  background: #0f1f36;
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .toc-title { color: rgba(255,255,255,0.4); }
[data-theme="dark"] .toc-list a { color: rgba(255,255,255,0.5); }
[data-theme="dark"] .toc-list a:hover,
[data-theme="dark"] .toc-list a.active {
  color: #e2e8f0;
  background: rgba(255,255,255,0.05);
}

/* Content */
[data-theme="dark"] .legal-content h2 { color: #e2e8f0; }
[data-theme="dark"] .legal-content h3 { color: #cbd5e1; }
[data-theme="dark"] .legal-content p,
[data-theme="dark"] .legal-content li { color: #94a3b8; }
[data-theme="dark"] .legal-content strong { color: #e2e8f0; }
[data-theme="dark"] .legal-content code {
  background: rgba(255,255,255,0.07);
  color: var(--tertiary);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .legal-content a { color: #5baef0; }
[data-theme="dark"] .legal-content section { border-bottom-color: rgba(255,255,255,0.08); }

/* Tables */
[data-theme="dark"] .cookie-table-wrapper { border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .cookie-table thead { background: #0f1f36; }
[data-theme="dark"] .cookie-table th { color: rgba(255,255,255,0.4); border-bottom-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .cookie-table td { color: #94a3b8; border-bottom-color: rgba(255,255,255,0.07); }
[data-theme="dark"] .cookie-table tr:hover td { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .cookie-table a { color: #5baef0; }

[data-theme="dark"] .cookie-tag.essential {
  background: rgba(94,140,200,0.15);
  color: #93c5fd;
  border-color: rgba(94,140,200,0.3);
}
[data-theme="dark"] .cookie-tag.analytics {
  background: rgba(0,229,255,0.1);
  color: #67e8f9;
  border-color: rgba(0,229,255,0.25);
}
[data-theme="dark"] .cookie-tag.preference {
  background: rgba(148,163,184,0.1);
  color: #94a3b8;
  border-color: rgba(148,163,184,0.2);
}

/* Contact block */
[data-theme="dark"] .contact-block {
  background: #0f1f36;
  border-color: rgba(255,255,255,0.1);
  border-left-color: var(--tertiary);
}
[data-theme="dark"] .contact-block p { color: #94a3b8; }
[data-theme="dark"] .contact-block a { color: #5baef0; }

/* Legal footer links */
[data-theme="dark"] .legal-footer-links { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .legal-footer-links a {
  color: rgba(255,255,255,0.45);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .legal-footer-links a:hover {
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
  .legal-layout {
    grid-template-columns: 200px 1fr;
    gap: 36px;
  }
}

/* Mobile — collapse TOC to top */
@media (max-width: 720px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    border-radius: var(--radius);
    margin-bottom: 36px;
  }

  .toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .toc-list a {
    border-left: none;
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 5px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .toc-list a:hover,
  .toc-list a.active {
    border-color: var(--tertiary);
    background: var(--tertiary-dim);
    color: var(--primary);
  }

  [data-theme="dark"] .toc-list a {
    border-color: rgba(255,255,255,0.1);
  }
  [data-theme="dark"] .toc-list a:hover,
  [data-theme="dark"] .toc-list a.active {
    border-color: var(--tertiary);
    background: rgba(0,229,255,0.08);
    color: #e2e8f0;
  }

  .legal-hero { padding: 40px 0 36px; }
  .legal-main { padding: 36px 0 64px; }

  .cookie-table th,
  .cookie-table td { padding: 10px 12px; }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .nav-back span { display: none; }
  .legal-footer-links { flex-direction: column; }
  .legal-footer-links a { justify-content: center; }
}

/* ═══════════════════════════════════════════════════════
   COOKIE CONSENT BANNER
══════════════════════════════════════════════════════════ */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: #001e42;
  border-top: 1px solid rgba(0,229,255,0.22);
  box-shadow: 0 -6px 32px rgba(0,0,0,0.28);
  padding: 18px 0;
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.4,0,0.2,1);
}
.cookie-banner.cb-visible { transform: translateY(0); }
.cookie-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cookie-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}
.cookie-banner-icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
  color: var(--tertiary);
  margin-top: 2px;
}
.cookie-banner-text p {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.55;
}
.cookie-banner-text a {
  color: var(--tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-banner-text a:hover { text-decoration: none; opacity: 0.85; }
.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}
.cb-btn-secondary {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.22);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.cb-btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}
.cb-btn-primary {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--tertiary);
  color: var(--primary);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0,229,255,0.3);
  font-family: 'Inter', sans-serif;
}
.cb-btn-primary:hover {
  background: #26eeff;
  box-shadow: 0 6px 20px rgba(0,229,255,0.45);
  transform: translateY(-1px);
}
@media (max-width: 600px) {
  .cookie-banner-inner { flex-direction: column; gap: 14px; }
  .cookie-banner-actions { width: 100%; }
  .cb-btn-secondary,
  .cb-btn-primary { flex: 1; text-align: center; justify-content: center; }
}
