/* ────────────────────────────────────────────────────────────────────
   Shared styles for Seedling legal pages.
   Mirrors the landing page's tokens + nav + footer, plus a reading layout
   tuned for long-form policy text. Used by everything under /legal/.
   ──────────────────────────────────────────────────────────────────── */

:root {
  /* Brand tokens — kept in lockstep with Seedling.html */
  --cream: #F5F0E8;
  --terracotta: #C4622D;
  --sage: #7C9A7E;
  --bark: hsl(25 30% 22%);
  --bark-light: hsl(25 15% 48%);
  --sunflower: hsl(42 85% 62%);
  --sage-light: hsl(150 20% 90%);
  --terracotta-light: hsl(16 40% 90%);
  --cream-dark: hsl(40 30% 90%);

  --paper: hsl(40 36% 96%);
  --ink: var(--bark);
  --ink-soft: hsl(25 22% 32%);
  --ink-mute: var(--bark-light);
  --sage-deep: hsl(140 16% 36%);
  --rule: var(--cream-dark);
  --accent: var(--terracotta);
  --radius: 1rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  font-size: 17px;
}

/* Paper grain — same SVG noise overlay as landing */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.13  0 0 0 0 0.09  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/></svg>");
  opacity: 0.22;
  mix-blend-mode: multiply;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
::selection { background: var(--sage); color: var(--paper); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 48px; }
@media (max-width: 720px) { .wrap { padding: 0 24px; } }

/* ── Nav ───────────────────────────────────────────────────────── */
.legal-nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--cream) 80%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.legal-nav .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 48px;
}
@media (max-width: 720px) { .legal-nav .wrap { padding: 16px 24px; } }
.logo {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 24px;
  letter-spacing: -0.02em; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.logo-mark {
  width: 36px; height: 36px; object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(60,40,15,0.15));
}
.back-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper);
  transition: background .15s ease;
}
.back-link:hover { background: var(--cream-dark); color: var(--ink); }

/* ── Legal layout ─────────────────────────────────────────────── */
.legal-main { padding: 64px 0 96px; }
@media (max-width: 720px) { .legal-main { padding: 40px 0 64px; } }

.legal-header {
  max-width: 760px;
  margin-bottom: 56px;
}
.section-marker {
  display: inline-flex; align-items: center; gap: 14px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--sage-deep);
  margin-bottom: 22px;
}
.section-marker::before {
  content: ''; width: 28px; height: 1px; background: currentColor; opacity: 0.5;
}
.nr {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0.02em;
}

.legal-header h1 {
  font-size: clamp(48px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.legal-header .sub-en {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--ink-mute);
  font-size: 22px;
  letter-spacing: -0.005em;
  margin: 0 0 24px;
}
.legal-header .meta {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 28px;
}
.legal-header .intro {
  font-size: 19px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 56ch;
  padding: 22px 26px;
  background: var(--paper);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.legal-header .intro strong { color: var(--ink); font-weight: 600; }

/* Two-column reading layout — article + sticky TOC */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 72px;
  align-items: start;
}
@media (max-width: 920px) {
  .legal-layout { grid-template-columns: 1fr; gap: 40px; }
  .legal-toc { order: -1; position: static !important; }
}

.legal-content { max-width: 720px; }
.legal-content section {
  margin-bottom: 56px;
  scroll-margin-top: 100px;
}
.legal-content section:last-child { margin-bottom: 0; }

.legal-content h2 {
  font-size: 30px;
  margin-bottom: 18px;
  display: flex; align-items: baseline; gap: 14px;
  letter-spacing: -0.015em;
}
.legal-content h2 .num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  font-size: 18px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.legal-content h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--ink);
}
.legal-content p {
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 14px;
  max-width: 64ch;
}
.legal-content p strong { color: var(--ink); font-weight: 600; }
.legal-content a { color: var(--accent); text-underline-offset: 3px; }
.legal-content a:hover { color: var(--ink); }

.legal-content ul, .legal-content ol {
  color: var(--ink-soft);
  line-height: 1.65;
  padding-left: 24px;
  margin: 0 0 14px;
  max-width: 64ch;
}
.legal-content li { margin: 6px 0; }
.legal-content li::marker { color: var(--accent); }

/* Definition / data table */
.dl {
  margin: 18px 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px 24px;
  font-size: 15px;
  max-width: 64ch;
}
.dl dt {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.dl dd {
  margin: 0;
  color: var(--ink-soft);
}
@media (max-width: 560px) {
  .dl { grid-template-columns: 1fr; gap: 4px 0; }
  .dl dd { margin-bottom: 12px; }
}

/* Placeholder marker — visible in dev so Claude Code knows where to fill */
.placeholder {
  display: block;
  padding: 14px 18px;
  background: hsl(42 75% 88% / 0.55);
  border: 1px dashed hsl(42 50% 50% / 0.7);
  border-radius: 12px;
  color: hsl(28 50% 30%);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 18px;
}
.placeholder::before {
  content: '⌭ ';
  font-style: normal;
  color: hsl(28 60% 38%);
  margin-right: 4px;
}

/* (AI) brand label — mirrors landing */
.ai-mark {
  display: inline-flex; align-items: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  font-size: 0.78em;
  padding: 2px 9px 3px;
  background: var(--terracotta-light);
  border-radius: 999px;
  line-height: 1.2;
  vertical-align: 2px;
}
.ai-mark::before {
  content: ''; width: 5px; height: 5px;
  background: var(--accent); border-radius: 50%;
  margin-right: 7px;
}

/* Sticky TOC */
.legal-toc {
  position: sticky;
  top: 90px;
  align-self: start;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.toc-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--sage-deep);
  margin-bottom: 14px;
  display: block;
}
.legal-toc ol {
  list-style: none; counter-reset: toc;
  padding: 0; margin: 0;
}
.legal-toc li {
  counter-increment: toc;
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  border-top: 1px dotted color-mix(in srgb, var(--rule) 75%, transparent);
}
.legal-toc li:first-child { border-top: 0; }
.legal-toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.legal-toc a {
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.4;
}
.legal-toc a:hover { color: var(--ink); }

/* Related-pages footer block — surfaces other legal pages */
.legal-related {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.legal-related .label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--sage-deep);
  margin-bottom: 18px;
}
.legal-related .links {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.legal-related a {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  font-weight: 500;
  transition: background .15s ease;
}
.legal-related a:hover { background: var(--cream-dark); }
.legal-related a.current {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

/* ── Footer (smaller than landing) ─────────────────────────────── */
.legal-footer {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
  font-size: 13px;
  color: var(--ink-mute);
}
.legal-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
}
.legal-footer em {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ── Bilingual toggle (nb / en) ─────────────────────────────────── */
body[data-lang="no"] .en-only { display: none; }
body[data-lang="en"] .no-only { display: none; }
body[data-lang="en"] .sub-en  { display: none; }

.lang-toggle {
  display: inline-flex; gap: 0; align-items: stretch;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 3px; background: var(--paper);
}
.lang-toggle button {
  border: 0; background: transparent; padding: 5px 11px;
  border-radius: 999px; font: inherit; cursor: pointer;
  color: var(--ink-mute); text-transform: uppercase;
}
.lang-toggle button.on { background: var(--ink); color: var(--paper); }
