/* Legal & policy documents
   (privacy, cookies, modern slavery, digital sustainability, subscription agreement, schedules) */

/* ---------- Page heading ---------- */
.legal-title { padding-block: clamp(40px, 5vw, 80px); }
.legal-title h1 { max-width: 900px; }
.legal-title .meta { display: flex; align-items: center; gap: 8px; }
.legal-title .meta .icon { width: 18px; height: 18px; color: var(--green); }
.legal-title .meta strong { color: inherit; font-weight: 600; }

/* Wide wrapper for documents with an "On this page" sidebar (260 + gap + 820 text column) */
.legal-wrap { max-width: calc(1180px + var(--gutter) * 2); }

.legal { padding-block: clamp(40px, 5vw, 72px) var(--section-y); }

/* ---------- Document text ---------- */
.legal-doc { max-width: 820px; overflow-wrap: break-word; }
.legal-doc h2 {
  margin: 1.75em 0 .7em; padding-top: 1.1em; border-top: 1px solid var(--line);
  font-size: clamp(1.375rem, 1.2rem + .6vw, 1.75rem); color: var(--green);
}
.legal-doc h2:first-child { padding-top: 0; border-top: 0; }
.legal-doc h3 { margin: 2em 0 .6em; font-size: clamp(1.125rem, 1.05rem + .3vw, 1.3125rem); }
.legal-doc h4 { margin: 1.6em 0 .4em; font-size: 1.0625rem; }
.legal-doc h2 + h3 { margin-top: 1.25em; }
.legal-num { color: var(--green); }
.legal-kicker {
  display: block; margin-bottom: .45em;
  font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.legal-doc a { overflow-wrap: anywhere; }
.legal-doc ul { padding-left: 1.3em; }
.legal-doc a strong { color: inherit; }
.legal-points li + li { margin-top: .85em; }

/* Numbered clauses: hanging number, sub-clauses indented under their parent's text */
.clause { --num-w: 3rem; display: grid; grid-template-columns: var(--num-w) minmax(0, 1fr); column-gap: .75rem; }
.legal-doc .clause--l3 { --num-w: 3.5rem; margin-left: 3.75rem; }
.legal-doc .clause--l2 + ul { margin-left: 3.75rem; }   /* a list that belongs to a clause sits under its text */
.legal-doc .clause--l3 + ul { margin-left: 8rem; }
.clause__num { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.clause__title { font-weight: 600; font-size: .9375em; letter-spacing: .02em; color: var(--ink); }
.clause__term { font-style: normal; font-weight: 600; color: var(--ink); }
@media (max-width: 600px) {
  .clause { display: block; }
  .clause__num { margin-right: .3em; }
  .legal-doc .clause--l3 { margin-left: 0; padding-left: 14px; border-left: 2px solid var(--green-100); }
  .legal-doc .clause--l2 + ul { margin-left: 0; }
  .legal-doc .clause--l3 + ul { margin-left: 16px; }
}

/* Replacement / added contract language (country-specific provisions) */
.legal-quote { font-size: 1rem; }
.legal-quote p { margin: 0; }

/* Tables (cookie types, incident priority, response times) */
.legal-table { margin: 1.25em 0 1.75em; background: #fff; }
.legal-doc .legal-table .table { display: table; min-width: 0; margin: 0; font-size: .9375rem; line-height: 1.5; overflow: visible; }
.legal-doc .legal-table th,
.legal-doc .legal-table td { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); }
.legal-doc .legal-table tbody tr:last-child > * { border-bottom: 0; }
.legal-doc .legal-table thead th { background: var(--green-50); color: var(--ink); font-weight: 600; }
.legal-doc .legal-table tbody th { background: transparent; color: var(--ink); font-weight: 600; }
@media (max-width: 480px) {
  .legal-doc .legal-table th, .legal-doc .legal-table td { padding: 10px 12px; }
}
/* Three-column tables become one card per row on phones (roles keep the table semantics) */
@media (max-width: 560px) {
  .legal-table--stack thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .legal-doc .legal-table--stack .table, .legal-table--stack tbody, .legal-table--stack tr,
  .legal-doc .legal-table--stack th, .legal-doc .legal-table--stack td { display: block; }
  .legal-table--stack tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .legal-table--stack tbody tr:last-child { border-bottom: 0; }
  .legal-doc .legal-table--stack tbody th { padding: 0 0 6px; border: 0; }
  .legal-doc .legal-table--stack td {
    display: grid; grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr); gap: 12px; padding: 4px 0; border: 0;
  }
  .legal-table--stack td::before { content: attr(data-label); font-size: .8125rem; font-weight: 600; color: var(--muted); padding-top: 1px; }
}

/* Contact details card */
.legal-contact { margin-top: 1.25em; padding: 20px 24px; border-radius: var(--radius-lg); background: var(--bg-soft); border: 1px solid var(--line); }
.legal-contact p { margin: 0; }

/* ---------- "On this page" table of contents ----------
   One <details> serves both layouts: collapsible card on small screens, always-open sticky sidebar on wide ones. */
.legal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.toc__label { display: none; }
.toc__details { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.toc__summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 14px 20px;
  font-weight: 600; color: var(--ink); cursor: pointer; list-style: none;
}
.toc__summary::-webkit-details-marker { display: none; }
.toc__summary::after {
  content: ""; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--green-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233a755f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px no-repeat;
  transition: transform .25s var(--ease);
}
.toc__details[open] > .toc__summary { border-bottom: 1px solid var(--line); }
.toc__details[open] > .toc__summary::after { transform: rotate(180deg); }
.toc__summary:hover { color: var(--green); }

.toc__list, .toc__list ol { margin: 0; padding: 0; list-style: none; }
.toc__list { padding: 12px 12px 16px; font-size: .9375rem; line-height: 1.35; }
.toc__list a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 600; }
.toc__list a:hover { background: var(--green-50); color: var(--green); }
.toc__list ol { margin: 2px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.toc__list ol a { padding: 6px 10px; font-weight: 400; color: var(--text); font-size: .875rem; }

@media (min-width: 1100px) {
  .legal-layout { grid-template-columns: 260px minmax(0, 820px); gap: clamp(48px, 5vw, 80px); align-items: start; }
  .legal-aside {
    position: sticky; top: var(--header-h);
    max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  }
  /* Browsers that can style the details content keep the list permanently open as a sidebar */
  @supports selector(::details-content) {
    .toc__label {
      display: block; margin: 0 0 8px; padding-left: 10px;
      font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
    }
    .toc__details { border: 0; border-radius: 0; background: none; }
    .toc__details > .toc__summary { display: none; }
    .toc__details::details-content { content-visibility: visible; display: block; }
    .toc__list { padding: 0 0 24px; font-size: .875rem; }
    .toc__list a { padding: 6px 10px; }
    .toc__list ol a { padding: 5px 10px; font-size: .8125rem; }
  }
}

@media print {
  .legal-aside { display: none; }
  .legal-layout { display: block; }
}
