/* ============================================================
   FLIQ — Legal document pages (privacy, terms)
   Layered on top of roadmap/subpage.css, which supplies the brand
   tokens (--fliq-*, --font-*, --pad) and the page chrome.

   The body markup is generated at build time by
   assets/content-blocks.js from the `sections` array in the text
   repo's content.json — see build-i18n.js injectStructured().
   ============================================================ */

.legal-layout{
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
}

/* ── table of contents ───────────────────────────────────────── */

.legal-toc{
  position: sticky;
  top: 100px;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.5;
  background: var(--fliq-white);
  border: 1px solid color-mix(in srgb, var(--fliq-ink) 10%, transparent);
  border-radius: 20px;
  padding: 20px 22px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.legal-toc .toc-head{
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fliq-ink-3);
  font-weight: 500;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--fliq-line);
}
.legal-toc-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.legal-toc-list a{
  color: var(--fliq-ink-2);
  text-decoration: none;
  display: flex;
  gap: 10px;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  transition: color .2s ease, background .2s ease;
}
.legal-toc-list a:hover{ color: var(--fliq-green); background: var(--fliq-cream); }
/* Scroll-spy: 18 000 pixels of policy is easy to get lost in. */
.legal-toc-list a[aria-current="true"]{
  color: var(--fliq-ink);
  background: color-mix(in srgb, var(--fliq-green) 11%, transparent);
}
.legal-toc-list a[aria-current="true"] .toc-num{ color: var(--fliq-green); }
.legal-toc-list .toc-num{
  color: var(--fliq-ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
}

/* ── document body ───────────────────────────────────────────── */

.legal-body{
  font-family: var(--font-body);
  color: var(--fliq-ink-2);
  font-size: clamp(15px, 1.15vw, 16.5px);
  line-height: 1.75;
  /* The card holds the width; the measure is set on the children below, so a
     table can still use the full card while prose stays readable. */
  max-width: none;
  background: var(--fliq-white);
  border: 1px solid color-mix(in srgb, var(--fliq-ink) 10%, transparent);
  border-radius: 24px;
  padding: clamp(24px, 3.4vw, 52px);
  box-shadow: 0 34px 80px -58px color-mix(in srgb, var(--fliq-forest) 60%, transparent);
}
.legal-body > .legal-sec > p,
.legal-body > .legal-sec > ul,
.legal-body > .legal-sec > ol,
.legal-body > .legal-sec > .legal-note,
.legal-body > .legal-sec > .legal-dl{ max-width: 68ch; }
.legal-meta{
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fliq-ink-3);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 clamp(30px, 3.6vw, 48px);
  padding: 8px 15px;
  border: 1px solid var(--fliq-line);
  border-radius: 999px;
  background: var(--fliq-cream);
}
.legal-meta::before{
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fliq-green);
  flex: none;
}

.legal-sec{ margin: 0 0 clamp(36px, 4.4vw, 60px); scroll-margin-top: 110px; }
.legal-sec:last-child{ margin-bottom: 0; }
/* A hairline between sections gives a long document a rhythm to scan by. */
.legal-sec + .legal-sec{
  border-top: 1px solid var(--fliq-line);
  padding-top: clamp(30px, 3.8vw, 52px);
}

.legal-sec h2{
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(21px, 2.1vw, 27px);
  line-height: 1.25;
  color: var(--fliq-ink);
  margin: 0 0 20px;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
.legal-sec h2 .sec-num{
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fliq-green) 13%, transparent);
  color: var(--fliq-green);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
  margin-top: .12em;
}
/* A flex item will not shrink below its longest word unless told to, and
   Swedish legal headings have words like "Integritetsskyddsmyndigheten" that
   are wider than a 320px phone.

   min-width:0 lets the item shrink past its automatic minimum, and
   overflow-wrap:anywhere is what actually lowers the min-content size —
   break-word permits a break but leaves min-content at the longest word, so
   the heading still pushed the page sideways. hyphens:auto gives the browser
   a proper Swedish hyphenation point to prefer over a bare mid-word break. */
.legal-sec h2 .sec-title{
  min-width: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.legal-sec h3{
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(16px, 1.4vw, 18px);
  color: var(--fliq-ink);
  margin: clamp(28px, 3vw, 38px) 0 12px;
  scroll-margin-top: 100px;
}
.legal-sec h3 .sub-num{
  color: var(--fliq-green);
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}

.legal-body p{ margin: 0 0 1.05em; }
.legal-body ul,
.legal-body ol{ margin: 0 0 1.05em; padding-left: 1.35em; }
.legal-body li{ margin-bottom: .5em; }
.legal-body li::marker{ color: var(--fliq-green); }

.legal-body a{
  color: var(--fliq-ink);
  text-decoration: underline;
  text-decoration-color: var(--fliq-green);
  text-underline-offset: 3px;
  transition: color .2s ease;
}
.legal-body a:hover{ color: var(--fliq-green); }

.legal-note{
  font-size: .93em;
  color: var(--fliq-ink-3);
  background: var(--fliq-cream);
  border: 1px solid var(--fliq-line);
  border-left: 3px solid var(--fliq-green);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 1.2em;
}

/* address / contact pairs */
.legal-dl{ margin: 0 0 1.05em; }
.legal-dl dt{
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fliq-ink-3);
  margin-top: .7em;
}
.legal-dl dd{ margin: 2px 0 0; }

/* ── retention table ─────────────────────────────────────────── */

/* The wrapper scrolls, never the page body. */
.legal-table-wrap{
  overflow-x: auto;
  margin: 0 0 1.4em;
  border: 1px solid var(--fliq-line);
  border-radius: 16px;
  -webkit-overflow-scrolling: touch;
}
.legal-table{
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 14px;
  line-height: 1.55;
}
.legal-table caption{
  caption-side: top;
  text-align: left;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fliq-ink-3);
  padding: 14px 16px 0;
}
.legal-table th,
.legal-table td{
  text-align: left;
  vertical-align: top;
  padding: 12px 16px;
  border-bottom: 1px solid var(--fliq-line);
}
.legal-table thead th{
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fliq-ink-3);
  background: var(--fliq-cream);
  white-space: nowrap;
}
.legal-table tbody th{
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--fliq-ink);
}
.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td{ border-bottom: 0; }

/* ── narrow screens ──────────────────────────────────────────── */

@media (max-width: 900px){
  .legal-layout{ grid-template-columns: minmax(0, 1fr); gap: 0; }
  .legal-toc{
    position: static;
    max-height: none;
    margin-bottom: clamp(30px, 5vw, 44px);
    padding: 18px 20px;
  }
  .legal-toc .toc-head{ border-bottom-color: rgba(0,0,0,.08); }
  .legal-body{ max-width: none; }
}

/* ── print: a legal document has to survive Ctrl+P ───────────── */

@media print{
  .fliq-nav, .legal-toc, .cta-block, .rich-foot, .sub-hero .crumbs{ display: none !important; }
  .legal-layout{ display: block; }
  .legal-body{
    max-width: none; font-size: 10.5pt; line-height: 1.5; color: #000;
    background: none; border: 0; border-radius: 0; padding: 0; box-shadow: none;
  }
  .legal-meta{ border: 0; background: none; padding: 0; }
  .legal-meta::before{ display: none; }
  .legal-sec + .legal-sec{ border-top: 0; padding-top: 0; }
  .legal-note{ background: none; border-radius: 0; }
  .legal-sec{ margin-bottom: 20pt; page-break-inside: auto; }
  .legal-sec h2, .legal-sec h3{ page-break-after: avoid; color: #000; }
  .legal-table-wrap{ overflow: visible; border-color: #999; }
  .legal-table{ min-width: 0; page-break-inside: auto; }
  .legal-table thead{ display: table-header-group; }
  .legal-table tr{ page-break-inside: avoid; }
  .legal-body a{ color: #000; text-decoration: underline; }
  /* Show the destination of external links on paper. */
  .legal-body a[href^="http"]::after{
    content: " (" attr(href) ")";
    font-size: 8.5pt;
    word-break: break-all;
  }
}
