/* Loopmerce - Legal pages (Privacy, Terms, DPA, How Your Data Is Managed,
   Cookie Policy, AES-256 Encrypted Credentials).
   Scoped to .legal-page. Uses the shared design tokens from style.css and the
   shared .site-header / .site-footer. Trustworthy and readable, not marketing:
   dark navy text, blue links, generous line-height, 800-900px measure, a sticky
   table of contents that releases correctly, print-friendly. Minimal motion. */

/* skip-to-content link (accessibility) */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent-ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 12px; outline: 3px solid #fff; outline-offset: 2px; }

.legal-page {
  background:
    radial-gradient(1100px 380px at 50% -160px, #EEF4FF 0%, rgba(238,244,255,0) 70%),
    var(--bg);
  color: var(--ink);
}
.legal-page .wrap { max-width: 1120px; }

/* legal content should always be visible, even if JS never runs */
.legal-page .legal-body,
.legal-page .legal-hero { opacity: 1 !important; transform: none !important; }

/* ---------- page header ---------- */
.legal-hero {
  padding: clamp(28px, 5vw, 56px) 0 clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.legal-hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 6px 12px; border-radius: 999px;
}
.legal-hero__title {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em;
  line-height: 1.1; color: var(--ink); margin: 16px 0 10px;
}
.legal-hero__sub {
  font-size: 1.06rem; line-height: 1.6; color: var(--muted); max-width: 760px; margin: 0;
}
.legal-hero__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 20px;
  font-size: .86rem; color: var(--muted);
}
.legal-hero__meta strong { color: var(--ink); font-weight: 600; }
.legal-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 700; color: #9A5B00; background: #FFF4E0;
  border: 1px solid #F4D9A6; padding: 5px 11px; border-radius: 999px;
}
.legal-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #E8991A; }
.legal-print {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
  color: var(--accent-ink); background: #fff; border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 10px; min-height: 40px;
  transition: background .15s ease, border-color .15s ease;
}
.legal-print:hover { background: var(--accent-wash); border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.legal-print svg { width: 16px; height: 16px; }

/* ---------- shell: sticky TOC + body ---------- */
.legal-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 788px);
  gap: clamp(28px, 4vw, 56px);
  justify-content: center;
  padding: clamp(28px, 4vw, 48px) 0 clamp(48px, 7vw, 88px);
}

/* table of contents */
.legal-toc {
  position: sticky; top: 92px; align-self: start;
  max-height: calc(100vh - 116px); overflow: auto;
  font-size: .9rem;
}
.legal-toc h2 {
  font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
.legal-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.legal-toc li { margin: 0; }
.legal-toc a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; line-height: 1.4;
  border-left: 2px solid transparent;
}
.legal-toc a:hover { color: var(--accent-ink); background: var(--accent-wash); }
.legal-toc a.is-active { color: var(--accent-ink); background: var(--accent-wash); border-left-color: var(--blue); font-weight: 600; }

/* mobile TOC (collapsible) - hidden on desktop */
.legal-toc-m { display: none; }

/* ---------- body typography ---------- */
.legal-body { font-size: 1rem; line-height: 1.75; color: #23283A; max-width: 780px; }
.legal-body > section { scroll-margin-top: 92px; padding-top: 8px; }
.legal-body > section + section { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--line-2); }
.legal-body h2 {
  font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 800; letter-spacing: -.01em;
  color: var(--ink); line-height: 1.25; margin: 0 0 14px; scroll-margin-top: 92px;
}
.legal-body h2 .legal-num { color: var(--blue); font-weight: 800; margin-right: 8px; }
.legal-body h3 {
  font-size: 1.06rem; font-weight: 700; color: var(--ink); margin: 26px 0 8px; scroll-margin-top: 92px;
}
.legal-body p { margin: 0 0 14px; }
.legal-body ul, .legal-body ol { margin: 0 0 14px; padding-left: 22px; }
.legal-body li { margin: 6px 0; }
.legal-body li::marker { color: var(--muted); }
.legal-body strong { color: var(--ink); font-weight: 700; }
.legal-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.legal-body a:hover { color: var(--blue); }
.legal-body address { font-style: normal; line-height: 1.7; }

/* long URLs / emails wrap on mobile */
.legal-body .wrap-any { overflow-wrap: anywhere; word-break: break-word; }

/* ---------- tables ---------- */
.legal-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
.legal-table caption { text-align: left; font-size: .82rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line-2); line-height: 1.55; }
.legal-table thead th { background: var(--wash); color: var(--ink); font-weight: 700; font-size: .82rem; letter-spacing: .01em; position: sticky; top: 0; }
.legal-table tbody tr:last-child td { border-bottom: 0; }
.legal-table tbody tr:nth-child(even) td { background: #FBFCFE; }

/* ---------- callouts ---------- */
.legal-callout {
  border: 1px solid var(--line); background: var(--wash); border-radius: 12px;
  padding: 16px 18px; margin: 0 0 18px;
}
.legal-callout--info { border-color: #C7DBF7; background: #F1F6FF; }
.legal-callout--warn { border-color: #F4D9A6; background: #FFF9EF; }
.legal-callout__t { font-weight: 700; color: var(--ink); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.legal-callout p:last-child { margin-bottom: 0; }

/* cross-link chips at page foot */
.legal-related { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.legal-related h2 { font-size: 1.06rem; font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.legal-related__grid { display: flex; flex-wrap: wrap; gap: 10px; }
.legal-related__grid a {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-size: .9rem; font-weight: 600; color: var(--accent-ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 44px;
}
.legal-related__grid a:hover { background: var(--accent-wash); border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }

/* small print line */
.legal-fineprint { margin-top: 26px; font-size: .84rem; color: var(--muted); }

/* clickable AES-256 badge in the legal-page footer privacy block */
.footer__aeslink {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: .84rem; font-weight: 700; color: var(--accent-ink); text-decoration: none;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; min-height: 40px;
}
.footer__aeslink:hover { background: var(--accent-wash); border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.footer__aeslink svg { width: 15px; height: 15px; }

/* Cookiebot Cookie Declaration wrapper (Cookie Policy only). Style the surrounding
   section only; the table itself is generated by Cookiebot. overflow-x guards mobile. */
.cookie-declaration-section { overflow-x: auto; }
.cookie-declaration-section > p { color: var(--muted); }
.cookie-declaration-section .CookieDeclaration { max-width: 100%; margin-top: 8px; }

/* data-lifecycle helper (How Your Data Is Managed) */
.legal-flow { display: grid; gap: 10px; margin: 0 0 18px; }
.legal-flow__step {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 13px 15px;
}
.legal-flow__n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: .82rem; display: grid; place-items: center; }
.legal-flow__b strong { display: block; color: var(--ink); }
.legal-flow__b span { color: var(--muted); font-size: .92rem; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .legal-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .legal-toc { display: none; }
  .legal-toc-m { display: block; margin: 0 0 26px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .legal-toc-m > summary {
    list-style: none; cursor: pointer; padding: 14px 16px; min-height: 48px;
    font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: space-between;
  }
  .legal-toc-m > summary::-webkit-details-marker { display: none; }
  .legal-toc-m > summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; }
  .legal-toc-m[open] > summary::after { transform: rotate(-135deg); }
  .legal-toc-m nav { padding: 4px 8px 12px; }
  .legal-toc-m ol { list-style: none; margin: 0; padding: 0; }
  .legal-toc-m a { display: block; padding: 9px 10px; min-height: 40px; color: var(--muted); text-decoration: none; border-radius: 8px; }
  .legal-toc-m a:hover { color: var(--accent-ink); background: var(--accent-wash); }
  .legal-body { max-width: none; }
}

@media (max-width: 560px) {
  .legal-hero__meta { gap: 8px 14px; }
  .legal-body { font-size: .98rem; }
}

@media (prefers-reduced-motion: reduce) {
  .legal-page * { scroll-behavior: auto !important; }
  .legal-toc-m > summary::after { transition: none; }
}

/* ---------- print ---------- */
@media print {
  .sky, .site-header, .nav-mobile, .legal-toc, .legal-toc-m, .legal-print,
  .site-footer .footer__social, .site-footer .footer__trust, .legal-related,
  .closing, .cookie-banner { display: none !important; }
  .legal-page { background: #fff !important; }
  .legal-shell { grid-template-columns: 1fr; padding: 0; }
  .legal-body { max-width: none; color: #000; font-size: 11.5pt; line-height: 1.5; }
  .legal-hero { border-bottom: 1px solid #000; padding-top: 0; }
  .legal-hero__eyebrow { background: none; color: #000; padding: 0; }
  .legal-body > section + section { border-top: 1px solid #ccc; }
  .legal-body h2, .legal-body h3 { break-after: avoid; }
  .legal-table-wrap, .legal-table, .legal-callout, .legal-flow__step { break-inside: avoid; }
  .legal-table { min-width: 0; }
  /* show destinations of external links on paper */
  .legal-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; word-break: break-all; }
  .site-footer { background: #fff !important; border-top: 1px solid #000; }
}
