/* ==========================================================================
   Stitch: legal pages (privacy, terms)
   Loaded after styles.css, which supplies the brand tokens, header and footer.
   ========================================================================== */

.legal-page { background: var(--paper); }
.legal-page .site-header.is-scrolled { background: rgba(255, 247, 236, 0.9); }

.legal {
  width: 100%; max-width: var(--max); margin-inline: auto;
  padding: calc(var(--header-h) + clamp(40px, 8vw, 112px)) var(--gutter) clamp(72px, 10vw, 140px);
}

/* ---------- Title block ---------- */
.legal-head { max-width: 920px; }
.legal-kicker { font-weight: 600; font-size: 15px; letter-spacing: .02em; color: var(--brown); }
.legal-title {
  margin-top: 10px;
  font-family: var(--sc-font-display); font-weight: 400;
  font-size: clamp(54px, 9vw, 124px); line-height: .92; letter-spacing: -0.01em;
  color: var(--cocoa);
}
.legal-lede { margin-top: clamp(18px, 2.4vw, 28px); max-width: 46ch; font-size: clamp(18px, 1.5vw, 21px); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.legal-meta { margin-top: 14px; font-size: 14px; color: var(--ink-2); }
/* A loose strand under the title, the same thread that runs through the home page. */
.legal-thread { width: 100%; height: 28px; margin-top: clamp(32px, 5vw, 56px); overflow: visible; }
.legal-thread path { fill: none; stroke: var(--brown); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ---------- Contents + text ---------- */
.legal-body { margin-top: clamp(32px, 5vw, 64px); display: grid; gap: 32px; }

.legal-toc details { border-radius: var(--r-md); }
.legal-toc summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: 0 20px; cursor: pointer; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  font-weight: 600; font-size: 16px; color: var(--cocoa);
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after {
  content: ""; width: 9px; height: 9px; margin-top: -4px;
  border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(45deg); transition: transform .2s var(--ease);
}
.legal-toc details[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.legal-toc ol { counter-reset: toc -1; display: grid; gap: 2px; padding: 10px 0 0; }
.legal-toc li { counter-increment: toc; }
.legal-toc a {
  display: grid; grid-template-columns: 2.2em 1fr; align-items: baseline;
  padding: 7px 12px; border-radius: 10px;
  font-size: 15px; line-height: 1.35; color: var(--ink-2); text-decoration: none;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.legal-toc li:not(:first-child) a::before { content: counter(toc, decimal-leading-zero); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--tan); }
.legal-toc li:first-child a::before { content: ""; }
.legal-toc a[aria-current="true"] { color: var(--cocoa); background: rgba(207, 150, 105, 0.16); font-weight: 600; }
@media (hover: hover) { .legal-toc a:hover { color: var(--cocoa); } }
@media (max-width: 959px) {
  .legal-toc ol { padding: 8px 4px 4px; }
  .legal-toc a { padding: 9px 16px; }
}
@media (min-width: 960px) {
  .legal-body { grid-template-columns: 240px minmax(0, 1fr); column-gap: clamp(48px, 7vw, 112px); align-items: start; }
  .legal-toc { position: sticky; top: calc(var(--header-h) + 32px); }
  .legal-toc summary { display: none; }
  .legal-toc ol { padding-top: 0; }
}

/* ---------- The text ---------- */
.legal-text { max-width: 70ch; font-size: 17px; line-height: 1.7; color: var(--ink); }
.legal-text section { scroll-margin-top: calc(var(--header-h) + 24px); }
.legal-text section + section { margin-top: clamp(56px, 7vw, 88px); }
.legal-text h2 {
  display: flex; align-items: baseline; gap: 16px;
  font-family: var(--sc-font-display); font-weight: 400;
  font-size: clamp(32px, 3.4vw, 46px); line-height: 1.05; color: var(--cocoa); text-wrap: balance;
  margin-bottom: 20px;
}
.legal-num { flex: none; font-family: var(--sc-font-text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--tan); transform: translateY(-0.35em); }
.legal-text h3 { margin: 32px 0 12px; font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.legal-text p + p, .legal-text p + ul, .legal-text ul + p, .legal-text table + p { margin-top: 1em; }
.legal-text ul { display: grid; gap: 10px; }
.legal-text li { position: relative; padding-left: 22px; }
.legal-text li::before {
  content: ""; position: absolute; left: 3px; top: .68em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--tan);
}
.legal-text strong { font-weight: 600; }
.legal-text a { color: var(--cocoa); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
@media (hover: hover) { .legal-text a:hover { text-decoration-color: currentColor; } }

/* "In short": the whole policy on one card. */
.legal-short {
  padding: clamp(24px, 3.2vw, 40px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.legal-text .legal-short h2 { font-size: clamp(28px, 2.6vw, 36px); }

/* ---------- Table: lawful bases ---------- */
.legal-table { width: 100%; margin-top: 24px; border-collapse: collapse; font-size: 15.5px; line-height: 1.5; }
.legal-table th { padding: 0 16px 12px 0; text-align: left; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); border-bottom: 1.5px solid var(--line-strong); }
.legal-table td { padding: 14px 16px 14px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.legal-table td:first-child { width: 40%; }
.legal-table td:last-child { padding-right: 0; }
.legal-table td:nth-child(2) { color: var(--ink-2); }
@media (max-width: 700px) {
  .legal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; width: 100%; }
  .legal-table tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .legal-table tr:first-child { border-top: 1.5px solid var(--line-strong); }
  .legal-table td, .legal-table td:first-child { width: auto; padding: 0; border: 0; }
  .legal-table td + td { margin-top: 8px; }
  .legal-table td:first-child { font-weight: 600; }
  .legal-table td + td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--brown); }
}

/* ---------- Footer ---------- */
.legal-foot { border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.legal-foot a[aria-current="page"] { color: var(--cocoa); font-weight: 600; }
