/* ===================================================
   1% Better — legal.css
   Swiss Medical Precision Legal & Regulatory Experience
   Full Dual-Theme Architecture (Dark & Light)
   Used by: privacy.html, cookies.html, terms.html
   =================================================== */

:root {
  /* Default: Dark Theme (Swiss Medical Precision — Institutional Navy) */
  --legal-bg: #0b1021;
  --legal-bg-alt: #141b41;
  --legal-surface: #1e293b;
  --legal-surface-alt: rgba(30, 41, 59, 0.6);
  --legal-surface-hover: rgba(32, 164, 179, 0.08);
  --legal-border: rgba(32, 164, 179, 0.25);
  --legal-border-subtle: rgba(255, 255, 255, 0.08);
  --legal-text: #f8fafc;
  --legal-text-muted: #cbd5e1;
  --legal-text-subtle: #94a3b8;
  --legal-teal: #20a4b3;
  --legal-teal-hover: #26b9c9;
  --legal-teal-tint: rgba(32, 164, 179, 0.12);
  --legal-gold: #d4a437;
  --legal-gold-tint: rgba(212, 164, 55, 0.15);
  --legal-purple: #a78bfa;
  --legal-purple-tint: rgba(106, 61, 232, 0.15);
  --legal-nav-bg: rgba(11, 16, 33, 0.92);
  --legal-footer-bg: #070a14;
  --legal-card-shadow:
    0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(32, 164, 179, 0.15);
}

/* ── Light Theme Overrides ── */
[data-theme="light"] {
  --legal-bg: #ffffff;
  --legal-bg-alt: #f8fafc;
  --legal-surface: #f1f5f9;
  --legal-surface-alt: rgba(241, 245, 249, 0.85);
  --legal-surface-hover: rgba(32, 164, 179, 0.06);
  --legal-border: rgba(20, 27, 65, 0.14);
  --legal-border-subtle: rgba(0, 0, 0, 0.06);
  --legal-text: #141b41;
  --legal-text-muted: #334155;
  --legal-text-subtle: #64748b;
  --legal-teal: #167e8a;
  --legal-teal-hover: #20a4b3;
  --legal-teal-tint: rgba(32, 164, 179, 0.08);
  --legal-gold: #8a6a16;
  --legal-gold-tint: rgba(212, 164, 55, 0.1);
  --legal-purple: #5b30d0;
  --legal-purple-tint: rgba(106, 61, 232, 0.08);
  --legal-nav-bg: rgba(255, 255, 255, 0.94);
  --legal-footer-bg: #f8fafc;
  --legal-card-shadow:
    0 10px 30px -10px rgba(20, 27, 65, 0.08), 0 0 0 1px rgba(20, 27, 65, 0.08);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --legal-bg: #ffffff;
    --legal-bg-alt: #f8fafc;
    --legal-surface: #f1f5f9;
    --legal-surface-alt: rgba(241, 245, 249, 0.85);
    --legal-surface-hover: rgba(32, 164, 179, 0.06);
    --legal-border: rgba(20, 27, 65, 0.14);
    --legal-border-subtle: rgba(0, 0, 0, 0.06);
    --legal-text: #141b41;
    --legal-text-muted: #334155;
    --legal-text-subtle: #64748b;
    --legal-teal: #167e8a;
    --legal-teal-hover: #20a4b3;
    --legal-teal-tint: rgba(32, 164, 179, 0.08);
    --legal-gold: #8a6a16;
    --legal-gold-tint: rgba(212, 164, 55, 0.1);
    --legal-purple: #5b30d0;
    --legal-purple-tint: rgba(106, 61, 232, 0.08);
    --legal-nav-bg: rgba(255, 255, 255, 0.94);
    --legal-footer-bg: #f8fafc;
    --legal-card-shadow:
      0 10px 30px -10px rgba(20, 27, 65, 0.08), 0 0 0 1px rgba(20, 27, 65, 0.08);
  }
}

/* ── Layout Reset & Typography ── */
body {
  background: var(--legal-bg);
  color: var(--legal-text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  min-height: 100vh;
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

/* ── Header / Navigation ── */
.legal-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--legal-nav-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--legal-border);
  padding: 0 clamp(1rem, 4vw, 3rem);
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease;
}

.legal-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto;
  height: 68px;
  gap: 16px;
}

.legal-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--legal-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.legal-nav-brand svg {
  width: 26px;
  height: 26px;
  display: block;
}

.legal-nav-brand-text {
  background: linear-gradient(
    135deg,
    var(--legal-text) 60%,
    var(--legal-teal) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.legal-nav-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.legal-nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--legal-text-subtle);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-nav-link:hover,
.legal-nav-link.active {
  color: var(--legal-teal);
}

.legal-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legal-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--legal-text-subtle);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--legal-border);
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.legal-nav-back:hover {
  color: var(--legal-teal);
  border-color: var(--legal-teal);
  background: var(--legal-surface-hover);
}

/* ── Hero Section ── */
.legal-hero {
  background: linear-gradient(
    165deg,
    var(--legal-bg-alt) 0%,
    var(--legal-bg) 100%
  );
  border-bottom: 1px solid var(--legal-border);
  padding: clamp(3rem, 7vw, 4.5rem) clamp(1rem, 4vw, 3rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.legal-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 240px;
  background: radial-gradient(
    circle,
    rgba(32, 164, 179, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.legal-hero-inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.legal-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--legal-teal);
  background: var(--legal-teal-tint);
  border: 1px solid var(--legal-border);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 1.25rem;
  font-family: monospace;
}

.legal-hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  color: var(--legal-text);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}

.legal-hero-meta {
  font-size: 0.85rem;
  color: var(--legal-text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.legal-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Body Container ── */
.legal-body {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem);
}

/* ── Table of Contents ── */
.legal-toc {
  background: var(--legal-surface-alt);
  border: 1px solid var(--legal-border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 3rem;
  box-shadow: var(--legal-card-shadow);
}

.legal-toc-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--legal-teal);
  margin-bottom: 1rem;
  font-family: monospace;
}

.legal-toc ol {
  margin: 0;
  padding: 0 0 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px 24px;
}

.legal-toc ol li a {
  font-size: 0.88rem;
  color: var(--legal-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-toc ol li a:hover {
  color: var(--legal-teal);
}

/* ── Legal Sections ── */
.legal-section {
  margin-bottom: 3rem;
}

.legal-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--legal-text);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--legal-border);
  scroll-margin-top: 90px;
  letter-spacing: -0.015em;
}

.legal-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--legal-text);
  margin: 1.75rem 0 0.75rem;
}

.legal-section p {
  font-size: 0.94rem;
  line-height: 1.75;
  color: var(--legal-text-muted);
  margin-bottom: 1rem;
}

.legal-section ul,
.legal-section ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.legal-section li {
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--legal-text-muted);
  margin-bottom: 0.45rem;
}

.legal-section strong {
  color: var(--legal-text);
  font-weight: 600;
}

.legal-section a {
  color: var(--legal-teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

.legal-section a:hover {
  opacity: 0.85;
}

/* ── Data Tables ── */
.legal-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--legal-border);
  margin: 1.5rem 0;
  background: var(--legal-surface-alt);
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 520px;
}

.legal-table thead {
  background: var(--legal-teal-tint);
}

.legal-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--legal-teal);
  white-space: nowrap;
  border-bottom: 1px solid var(--legal-border);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.legal-table td {
  padding: 12px 16px;
  color: var(--legal-text-muted);
  vertical-align: top;
  border-bottom: 1px solid var(--legal-border-subtle);
  line-height: 1.55;
}

.legal-table tbody tr:last-child td {
  border-bottom: none;
}

.legal-table tbody tr:hover td {
  background: var(--legal-surface-hover);
}

/* ── Callout Box ── */
.legal-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--legal-teal-tint);
  border: 1px solid var(--legal-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.legal-callout p {
  margin: 0 !important;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Cookie Category Cards ── */
.cookie-category {
  background: var(--legal-surface);
  border: 1px solid var(--legal-border);
  border-left: 4px solid var(--legal-teal);
  border-radius: 0 10px 10px 0;
  padding: 1.35rem 1.65rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--legal-card-shadow);
}

.cookie-category.required {
  border-left-color: var(--legal-teal);
}

.cookie-category.consent {
  border-left-color: var(--legal-gold);
}

.cookie-category h3 {
  margin: 0 0 0.6rem !important;
  font-size: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cookie-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 12px;
  vertical-align: middle;
}

.cookie-badge.no-consent {
  background: var(--legal-teal-tint);
  color: var(--legal-teal);
  border: 1px solid var(--legal-border);
}

.cookie-badge.consent-required {
  background: var(--legal-gold-tint);
  color: var(--legal-gold);
  border: 1px solid rgba(212, 164, 55, 0.35);
}

/* ── Footer ── */
.legal-footer {
  background: var(--legal-footer-bg);
  border-top: 1px solid var(--legal-border);
  padding: 2.5rem clamp(1rem, 4vw, 3rem);
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease;
}

.legal-footer-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  text-align: center;
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  justify-content: center;
}

.legal-footer-links a {
  font-size: 0.86rem;
  color: var(--legal-text-subtle);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 4px 0;
}

.legal-footer-links a:hover {
  color: var(--legal-teal);
}

.legal-footer-links a.active {
  color: var(--legal-teal);
  font-weight: 600;
}

.legal-footer-copy {
  font-size: 0.8rem;
  color: var(--legal-text-subtle);
  margin: 0;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .legal-nav-center {
    display: none;
  }
  .legal-toc ol {
    grid-template-columns: 1fr;
  }
  .legal-body {
    padding: 1.75rem 1rem;
  }
  .legal-section h2 {
    font-size: 1.15rem;
  }
  .legal-hero h1 {
    font-size: 1.75rem;
  }
}
