/* ─────────────────────────────────────────────────────────────
   Decidia — Shared Legal Pages Stylesheet
   Used by: privacy-policy.html, terms-of-service.html
───────────────────────────────────────────────────────────── */

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

:root {
  --bg:           #f9f8f0;
  --bg-card:      #ffffff;
  --blue:         #167ead;
  --blue-light:   #88cde7;
  --green:        #bed68f;
  --navy:         #354156;
  --red:          #d64967;
  --dark:         #27272a;
  --muted:        #6b7280;
  --border:       #e2e1d7;
  --toc-width:    240px;
  --content-max:  720px;
  --radius:       10px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--dark);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Top nav ─────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(249, 248, 240, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  height: 32px;
  display: block;
}
.nav-logo-fallback {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-back:hover { color: var(--blue); }
.nav-back svg { flex-shrink: 0; }

/* ── Hero header ─────────────────────────────────────────── */
.legal-hero {
  background: var(--navy);
  padding: 48px 24px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.legal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(136,205,231,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 50%, rgba(190,214,143,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.legal-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-light);
  background: rgba(136, 205, 231, 0.15);
  border: 1px solid rgba(136, 205, 231, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.legal-hero h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 12px;
}

.legal-hero-meta {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
}
.legal-hero-meta strong {
  color: rgba(255,255,255,0.75);
  font-weight: 600;
}

/* ── Page layout ─────────────────────────────────────────── */
.legal-layout {
  max-width: 1060px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  grid-template-columns: var(--toc-width) 1fr;
  gap: 48px;
  align-items: start;
}

/* ── Table of contents ───────────────────────────────────── */
.toc-wrap {
  position: sticky;
  top: 80px; /* below nav */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.toc-wrap::-webkit-scrollbar { width: 4px; }
.toc-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

.toc-list a {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.toc-list a:hover {
  color: var(--blue);
  background: rgba(22, 126, 173, 0.06);
}
.toc-list a.active {
  color: var(--blue);
  font-weight: 600;
  border-left-color: var(--blue);
  background: rgba(22, 126, 173, 0.07);
}

/* ── Legal content ───────────────────────────────────────── */
.legal-content {
  min-width: 0; /* prevent grid blowout */
}

/* Section anchors with scroll offset */
.legal-section {
  scroll-margin-top: 80px;
  margin-bottom: 48px;
}
.legal-section:last-child { margin-bottom: 0; }

/* Section heading */
.legal-content h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(22, 126, 173, 0.10);
  color: var(--blue);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Subsection heading */
.legal-content h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark);
  margin: 20px 0 8px;
}

/* Body text */
.legal-content p {
  font-size: 0.9375rem;
  color: #3f3f46;
  margin-bottom: 12px;
  line-height: 1.75;
}

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

/* Lists */
.legal-content ul,
.legal-content ol {
  margin: 8px 0 12px 0;
  padding-left: 20px;
}
.legal-content li {
  font-size: 0.9375rem;
  color: #3f3f46;
  line-height: 1.7;
  margin-bottom: 5px;
}
.legal-content li strong { color: var(--dark); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.legal-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 400px;
}
.legal-content thead {
  background: var(--navy);
  color: #fff;
}
.legal-content thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.legal-content tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.1s;
}
.legal-content tbody tr:nth-child(even) {
  background: rgba(249, 248, 240, 0.6);
}
.legal-content tbody tr:hover {
  background: rgba(22, 126, 173, 0.04);
}
.legal-content td {
  padding: 10px 14px;
  color: #3f3f46;
  vertical-align: top;
}
.legal-content td strong { color: var(--dark); }

/* Callout / highlight boxes */
.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.65;
}
.callout p { font-size: 0.9rem; margin-bottom: 0; }
.callout.blue {
  background: rgba(22, 126, 173, 0.07);
  border-left: 3px solid var(--blue);
  color: var(--navy);
}
.callout.green {
  background: rgba(190, 214, 143, 0.20);
  border-left: 3px solid #7aab3a;
  color: #2d4a10;
}
.callout.red {
  background: rgba(214, 73, 103, 0.07);
  border-left: 3px solid var(--red);
  color: #7a1a2e;
}
.callout.navy {
  background: rgba(53, 65, 86, 0.07);
  border-left: 3px solid var(--navy);
  color: var(--navy);
}

/* Uppercase important notice */
.legal-caps {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.65;
}

/* Links */
.legal-content a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: rgba(22, 126, 173, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}
.legal-content a:hover {
  text-decoration-color: var(--blue);
}

/* Strong emphasis */
.legal-content strong { color: var(--dark); font-weight: 600; }

/* ── Contact card ────────────────────────────────────────── */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 16px;
}
.contact-card p {
  margin-bottom: 4px !important;
  font-size: 0.9375rem;
}
.contact-card .contact-name {
  font-weight: 700;
  color: var(--navy);
  font-size: 1rem;
  margin-bottom: 8px !important;
}

/* ── Footer ──────────────────────────────────────────────── */
.legal-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  line-height: 1.7;
}
.legal-footer a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
}
.legal-footer a:hover { color: var(--blue-light); }
.legal-footer .footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 24px 20px 60px;
  }

  /* Show ToC as collapsed accordion on mobile */
  .toc-wrap {
    position: static;
    max-height: none;
    margin-bottom: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
  }

  .legal-hero {
    padding: 36px 20px 32px;
  }

  .legal-content h2 {
    font-size: 1.0625rem;
  }
}

@media (max-width: 480px) {
  .top-nav { padding: 0 16px; }
  .legal-layout { padding: 20px 16px 48px; }
}

/* ── Print styles ────────────────────────────────────────── */
@media print {
  .top-nav, .toc-wrap, .legal-footer { display: none; }
  .legal-layout { grid-template-columns: 1fr; padding: 0; }
  .legal-hero { background: none; padding: 0 0 24px; }
  .legal-hero h1 { color: var(--dark); font-size: 1.5rem; }
  .legal-hero-meta, .legal-badge { color: var(--muted); }
  .legal-content h2 { color: var(--dark); break-after: avoid; }
  .legal-content h3 { break-after: avoid; }
  .legal-section { break-inside: avoid-page; }
  a { color: var(--dark); text-decoration: none; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: var(--muted); }
}
