/* ==========================================================================
   OpenSpace Legal & Policy Pages (Privacy & Cookies)
   ========================================================================== */

:root {
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  
  --green: #006e2f;
  --green-bright: #15803d;
  --green-emerald: #16a34a;
  --green-vibrant: #22c55e;
  --green-soft: #ecfdf5;
  --green-light: #d1fae5;
  --green-border: #a7f3d0;
  --green-glow: rgba(34, 197, 94, 0.25);
  
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --body: #334155;
  --body-muted: #64748b;
  --border: #e2ece5;
  --border-light: #edf4ef;
  --bg-page: #f8faf9;
  --bg-card: #ffffff;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 10px 30px -4px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
}

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

html {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  background-image: radial-gradient(ellipse at 50% -80px, rgba(34, 197, 94, 0.08) 0%, transparent 650px);
  background-repeat: no-repeat;
  color: var(--body);
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.72;
}

/* Header */
.legal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.2s ease;
}

.legal-container {
  width: min(100% - 48px, 1080px);
  margin-inline: auto;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 74px;
}

.wordmark,
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.wordmark:hover,
.brand:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.brand-logo,
.wordmark img,
.brand img {
  display: block;
  height: 38px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 110, 47, 0.04);
}

.back-link::before {
  content: "←";
  font-size: 1.05em;
  line-height: 1;
  transition: transform 0.2s ease;
}

.back-link:hover {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 110, 47, 0.18);
}

.back-link:hover::before {
  transform: translateX(-3px);
}

.back-link:focus-visible {
  outline: 3px solid #86efac;
  outline-offset: 2px;
}

/* Main Content Card */
.legal-content {
  flex: 1;
  width: min(100% - 40px, 1080px);
  margin-block: 42px 64px;
  padding: 56px 64px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* Document Header Inside Content */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: fit-content;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-emerald);
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.45);
}

h1 {
  font-family: var(--font-heading);
  color: var(--ink);
  font-size: clamp(2.15rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin: 0 0 10px;
}

.updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid #edf2ee;
  color: var(--body-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.updated::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-color: #94a3b8;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Headings and Paragraphs */
h2 {
  font-family: var(--font-heading);
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin: 38px 0 12px;
  padding-left: 14px;
  border-left: 3px solid var(--green-vibrant);
}

p {
  margin: 0 0 18px;
  color: var(--body);
}

p:first-of-type {
  font-size: 1.02rem;
  line-height: 1.74;
  color: var(--ink-soft);
}

/* Links & Code */
a {
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(0, 110, 47, 0.35);
  text-underline-offset: 3px;
  transition: all 0.15s ease;
}

a:hover {
  color: var(--green-bright);
  text-decoration-color: var(--green-bright);
}

a:focus-visible {
  outline: 3px solid #86efac;
  outline-offset: 3px;
  border-radius: 3px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--ink);
  padding: 2px 7px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

/* Footer */
.legal-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: #ffffff;
  color: var(--body-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-block: 26px;
}

.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.footer-inner nav a {
  color: var(--body-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.footer-inner nav a:hover {
  color: var(--green);
  background: var(--green-soft);
}

.footer-inner nav a[aria-current="page"] {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .legal-container {
    width: calc(100% - 28px);
  }

  .header-inner {
    min-height: 64px;
  }

  .brand-logo,
  .wordmark img,
  .brand img {
    height: 32px;
    max-width: 140px;
  }

  .back-link {
    padding: 7px 14px;
    font-size: 0.82rem;
  }

  .legal-content {
    margin-block: 20px 40px;
    padding: 30px 20px;
    border-radius: var(--radius-md);
  }

  h1 {
    font-size: 1.85rem;
  }

  h2 {
    font-size: 1.15rem;
    margin-top: 30px;
    padding-left: 10px;
  }

  .updated {
    margin-bottom: 24px;
    padding-bottom: 16px;
    font-size: 0.82rem;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-block: 22px;
  }

  .footer-inner nav {
    gap: 6px;
  }
}
