/* ==========================================================================
   Legal Pages — Privacy Policy, Terms of Service, Cookie Policy
   Depends on: tokens.css (CSS variables must be loaded first)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Navigation — sticky, frosted glass
   -------------------------------------------------------------------------- */

.legal-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 64px;
  background: rgba(248, 244, 238, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(228, 221, 211, 0.6);
  display: flex;
  align-items: center;
  padding: 0 var(--space-xl);
  gap: var(--space-lg);
}

.legal-nav__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.legal-nav__logo svg {
  height: 32px;
  width: auto;
}

.legal-nav__divider {
  width: 1px;
  height: 20px;
  background: var(--stone);
  flex-shrink: 0;
}

.legal-nav__title {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.legal-nav__spacer {
  flex: 1;
}

.legal-nav__back {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--sage);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.legal-nav__back:hover {
  color: var(--moss);
}

.legal-nav__back svg {
  display: inline;
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   Page body wrapper
   -------------------------------------------------------------------------- */

.legal-body {
  min-height: 100vh;
  background: var(--cream);
}

/* --------------------------------------------------------------------------
   Main content container
   -------------------------------------------------------------------------- */

.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 100px;   /* clearance for fixed nav */
  padding-bottom: 80px;
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

/* --------------------------------------------------------------------------
   Document heading
   -------------------------------------------------------------------------- */

.legal-content h1 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 36px;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 8px;
}

/* "Last updated: …" line */
.legal-content .legal-updated {
  display: block;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink-muted);
  margin-bottom: 48px;
}

/* --------------------------------------------------------------------------
   Section headings
   -------------------------------------------------------------------------- */

.legal-content h2 {
  font-family: var(--font);
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 48px;
  margin-bottom: 16px;
  scroll-margin-top: 84px;
}

.legal-content h3 {
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  line-height: 1.4;
  margin-top: 32px;
  margin-bottom: 12px;
  scroll-margin-top: 84px;
}

/* --------------------------------------------------------------------------
   Body text
   -------------------------------------------------------------------------- */

.legal-content p {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-soft);
  font-weight: 300;
  margin-top: 0;
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */

.legal-content ul,
.legal-content ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 24px;
}

.legal-content li {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-soft);
  font-weight: 300;
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Inline elements
   -------------------------------------------------------------------------- */

.legal-content a {
  color: var(--sage);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.18s ease;
}

.legal-content a:hover {
  color: var(--moss);
}

.legal-content strong {
  font-weight: 500;
  color: var(--ink);
}

.legal-content hr {
  border: none;
  border-top: 1px solid var(--stone);
  margin: var(--space-2xl) 0;
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: var(--font);
}

.legal-content th {
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--stone);
  background: var(--cream-warm);
}

.legal-content td {
  font-size: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stone);
  color: var(--ink-soft);
  font-weight: 300;
  vertical-align: top;
}

/* --------------------------------------------------------------------------
   Highlight / callout block
   -------------------------------------------------------------------------- */

.legal-content .legal-highlight {
  background: var(--sage-wash);
  border-left: 3px solid var(--sage);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 24px 0;
}

.legal-content .legal-highlight p {
  margin-bottom: 0;
}

/* General callout (alternate naming used in some pages) */
.legal-callout {
  background: var(--sage-wash);
  border: 1px solid rgba(126, 155, 109, 0.25);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.65;
}

.legal-callout strong {
  font-weight: 500;
  color: var(--moss);
}

.legal-callout--clay {
  background: var(--clay-wash);
  border-color: rgba(192, 139, 92, 0.35);
  border-left-color: var(--clay);
}

.legal-callout--clay strong {
  color: var(--clay);
}

/* --------------------------------------------------------------------------
   Table of contents (optional component)
   -------------------------------------------------------------------------- */

.legal-toc {
  background: var(--parchment);
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.legal-toc__title {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-md);
  display: block;
}

.legal-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: var(--space-lg);
}

.legal-toc__list li {
  margin-bottom: 6px;
  break-inside: avoid;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.5;
}

.legal-toc__list a {
  color: var(--sage);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-toc__list a:hover {
  color: var(--moss);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Rights grid (GDPR / CCPA sections)
   -------------------------------------------------------------------------- */

.legal-rights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.legal-rights-card {
  background: var(--parchment);
  border: 1px solid var(--stone);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.legal-rights-card__label {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-sm);
  display: block;
}

.legal-rights-card__title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}

.legal-rights-card__desc {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 300;
  color: var(--ink-muted);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Footer — dark, matches main site
   -------------------------------------------------------------------------- */

.legal-footer {
  background-color: var(--ink);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.legal-footer__logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-md);
}

.legal-footer__logo svg {
  height: 28px;
  width: auto;
}

.legal-footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md) 0;
}

.legal-footer__link {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.legal-footer__link:hover {
  color: var(--cream);
}

.legal-footer__copy {
  font-family: var(--font);
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 300;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Responsive — Tablet (900px): collapse multi-column layouts
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .legal-toc__list {
    columns: 1;
  }

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

/* --------------------------------------------------------------------------
   Responsive — 768px: reduce heading sizes and padding
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .legal-nav {
    padding: 0 var(--space-md);
    gap: var(--space-sm);
  }

  .legal-content {
    padding-top: 88px;
    padding-bottom: 60px;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .legal-content h1 {
    font-size: 28px;
  }

  .legal-content h2 {
    font-size: 20px;
    margin-top: 40px;
  }

  .legal-content h3 {
    font-size: 16px;
    margin-top: 28px;
  }

  .legal-footer__links {
    gap: var(--space-md);
  }
}

/* --------------------------------------------------------------------------
   Responsive — Mobile (640px)
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .legal-nav__title {
    display: none;
  }

  .legal-nav__back span {
    display: none;
  }

  .legal-footer__links {
    gap: var(--space-sm);
  }
}

/* --------------------------------------------------------------------------
   Responsive — 480px: tables scroll horizontally
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .legal-content h1 {
    font-size: 24px;
  }

  /* Make tables scroll horizontally rather than overflow the viewport */
  .legal-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .legal-content th,
  .legal-content td {
    white-space: normal;
    min-width: 130px;
  }
}

/* --------------------------------------------------------------------------
   Cookie Policy — category badges and requirement indicators
   -------------------------------------------------------------------------- */

/* Scrollable wrapper for the cookie table (applied via .cookie-table-wrap) */
.cookie-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--stone);
  box-shadow: var(--shadow-card);
  margin: var(--space-lg) 0;
}

/* The table inside .cookie-table-wrap gets full-bleed treatment */
.cookie-table-wrap table {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* Category badge — inline pill inside table cells */
.cookie-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.cookie-badge--necessary {
  background: var(--sage-wash);
  color: var(--moss);
}

.cookie-badge--functional {
  background: var(--ochre-wash);
  color: var(--clay);
}

.cookie-badge--analytics {
  background: var(--clay-wash);
  color: var(--terracotta);
}

.cookie-badge--marketing {
  background: var(--terracotta-wash);
  color: var(--terracotta);
}

/* Required column indicators */
.req-yes {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--moss);
}

.req-no {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 300;
  color: var(--ink-muted);
}

/* Ochre (coming-soon) callout variant */
.legal-callout--ochre {
  background: var(--ochre-wash);
  border-color: rgba(212, 162, 78, 0.35);
  border-left-color: var(--ochre);
}

.legal-callout--ochre strong {
  color: var(--clay);
}
