/* Phoenix AI Solutions · legal.css
   The six legal pages (/privacy/, /terms/, /refunds/, /dpa/, /cookies/, /acceptable-use/) and /404.html.
   Page-scoped classes only (legal-*, nf-*); everything else comes from site.css. Spacing map: docs/spacing-maps/legal.md.

    1  Draft notice band         5  Plain-words panel, flow, example, address, aside
    2  Page grid and header      6  Tables (stacked variant for the wide ones, cookie rows, column widths)
    3  Contents list             7  End block, placeholders
    4  Sections, parts, clauses  8  The 404 page
                                 9  Phone and touch (phone pass, 13 Oct; legal fix lane, 13 Oct)
*/

/* ============================================================ 1. Draft notice band (rule 8: first thing on every legal page) */
.legal-draft { background: var(--grey); border-bottom: 1px solid var(--line-strong); }
.legal-draft .wrap-md { max-width: 984px; }                      /* the same 680 + 64 + 240 width as the page grid below, so the text lines up with the heading */
.legal-draft p { padding-block: var(--s-12); font: 500 15px/20px var(--font-text); color: var(--ink); }
.legal-draft strong { font-weight: 600; }

/* ============================================================ 2. Page grid and header */
.legal { padding-top: var(--s-64); }                            /* the band above already separates the page from the nav */
.legal-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.legal-head > * + * { margin-top: var(--s-16); }
.legal-head .lead { max-width: 680px; }
.legal-date { color: var(--ink-2); }
.legal-toc { margin-top: var(--s-24); }
.legal-body > .legal-sec:first-child { margin-top: var(--s-8); }     /* phone: header to first section 32 */
@media (min-width: 768px) and (max-width: 1023px) {
  .legal-grid { max-width: 680px; }                                   /* 65 to 75 characters a line, not 89 at tablet width */
  .legal-draft .wrap-md { max-width: 680px; }
}
/* The page starts on the one left edge: the DRAFT band and the grid are .wrap-md.is-left (site.css), so the headline sits level with the logo (x = 130 at 1440);
   the 680 reading column follows from there, and the 240 contents rail sits on the frame's right edge (1310 at 1440, the nav's edge), so the page
   no longer stops 196 short of it. The grid takes the frame's full 1180 for that; the DRAFT band keeps its 984. */
@media (min-width: 1024px) {
  .legal-grid {
    max-width: 1180px;
    grid-template-columns: minmax(0, 680px) 240px; grid-template-areas: "head toc" "body toc";
    column-gap: var(--s-64); justify-content: space-between; align-items: start;
  }
  .legal-head { grid-area: head; }
  .legal-body { grid-area: body; }
  .legal-body > .legal-sec:first-child { margin-top: var(--s-24); }  /* header to first section 48 (24 + the section's own 24) */
  .legal-toc {
    grid-area: toc; align-self: start; margin-top: 0;
    position: sticky; top: calc(var(--nav-h) + var(--s-24));
    max-height: calc(100vh - var(--nav-h) - var(--s-48)); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin;
    /* a soft shade at the top or foot only while there is more to scroll to (the paper-coloured covers scroll with the list and hide it at its ends) */
    background:
      linear-gradient(var(--paper) 50%, transparent) top / 100% 24px no-repeat local,
      linear-gradient(transparent, var(--paper) 50%) bottom / 100% 24px no-repeat local,
      linear-gradient(rgba(0, 0, 0, .10), transparent) top / 100% 12px no-repeat scroll,
      linear-gradient(transparent, rgba(0, 0, 0, .10)) bottom / 100% 12px no-repeat scroll;
  }
}

/* ============================================================ 3. Contents list (desktop: sticky, always open; phone: closed under a button) */
.legal-toc-box summary { display: none; }
.legal-toc-title { margin-bottom: var(--s-12); }
.legal-toc-list, .legal-toc-list ol { list-style: none; padding: 0; margin: 0; }
.legal-toc-list { border-left: 1px solid var(--line); }
.legal-toc-list a {
  display: block; margin-left: -1px; padding: var(--s-4) 0 var(--s-4) var(--s-16); border-left: 1px solid transparent;
  color: var(--ink-2); font: 400 15px/20px var(--font-text); text-wrap: pretty;
  transition: color var(--d-hover) var(--ease), border-color var(--d-hover) var(--ease);
}
.legal-toc-list a:hover { color: var(--ink); }
.legal-toc-list a:focus-visible { outline-offset: -2px; border-radius: var(--r-14); }       /* the ring sits inside the scrolling list, so it is never clipped */
.legal-toc-list a[aria-current="true"] { color: var(--ink); border-left-color: var(--ink); }
.legal-toc-part { margin-top: var(--s-12); }
.legal-toc-part > a { color: var(--ink); font-weight: 500; }
.legal-toc-part > ol a { padding-left: var(--s-32); }
.legal-toc-part + li:not(.legal-toc-part) { margin-top: var(--s-12); }
@media (max-width: 1023px) {
  .legal-toc-box summary {
    display: inline-flex; align-items: center; gap: var(--s-8); height: 44px; padding: 0 var(--s-16); border-radius: 980px;
    box-shadow: inset 0 0 0 1px var(--line-strong); font: 500 15px/1 var(--font-text); cursor: pointer; list-style: none;
  }
  .legal-toc-box summary::-webkit-details-marker { display: none; }
  .legal-toc-box summary::after {
    content: ""; width: 12px; height: 12px; background: currentColor; opacity: .6;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .legal-toc-box[open] summary::after { transform: rotate(180deg); }
  .legal-toc-title { display: none; }
  .legal-toc-list { margin-top: var(--s-12); padding: var(--s-8) var(--s-16); border-left: 0; border-radius: var(--r-14); background: var(--grey); }
  .legal-toc-list a { margin-left: 0; padding: var(--s-12) 0; border-left: 0; }                 /* each row is a 44 target (20 of text + 12 + 12) */
  .legal-toc-part > ol a { padding-left: var(--s-16); }
  .legal-toc-part { margin-top: var(--s-4); }
  .legal-toc-list a:active { color: var(--ink); }
  .legal-toc-box summary:active { background: var(--hover); }
  .legal-toc-list a[aria-current="true"] { font-weight: 500; }
}
@media (max-width: 1023px) and (scripting: enabled) {            /* no flash of an open list before the script closes it */
  .legal-toc-box:not([data-ready]) .legal-toc-list { display: none; }
}

/* ============================================================ 4. Sections, parts, clauses */
.legal-body { font: 400 17px/24px var(--font-text); }
.legal-sec { margin-top: var(--s-24); padding-top: var(--s-24); }   /* 48 between sections; the padding is inside the anchor so a jump lands the heading 24 under the nav */
.legal-sec > * + *, .legal-part > * + * { margin-top: var(--s-16); }
.legal-sec > :is(h2, h3) + *, .legal-part > :is(h2, .eyebrow) + * { margin-top: var(--s-12); }
.legal-sec > .legal-sub { margin-top: var(--s-32); }
.legal-sec > h2:first-child + .legal-sub { margin-top: var(--s-12); font: 600 17px/24px var(--font-text); }   /* straight under its section heading: a 17 kicker, so the two do not read as one two-line headline */
.legal-sec > h3:first-child + .legal-sub { margin-top: var(--s-24); }
.legal-sec > .legal-sub + * { margin-top: var(--s-12); }
.legal-sec > p + :is(ul, ol), .legal-cl > p + :is(ul, ol) { margin-top: var(--s-12); }   /* an intro line sits closer to its list than to the next paragraph */
.legal-body :is(ul, ol) { padding-left: var(--s-24); }
.legal-body li + li { margin-top: var(--s-8); }
.legal-body strong { font-weight: 600; }
.legal-body a:not(.btn, .link-arrow), .legal-head a {
  color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; border-radius: var(--r-14);
  transition: color var(--d-menu) var(--ease), text-decoration-thickness var(--d-menu) var(--ease);   /* 160 ms; the token goes to 0 under reduced motion */
}
@media (hover: hover) {
  .legal-body a:not(.btn, .link-arrow):hover, .legal-head a:hover { color: var(--blue-hover); text-decoration-thickness: 2px; }
}
.legal-body a:not(.btn, .link-arrow):focus-visible, .legal-head a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-14); }
.legal-body address { font-style: normal; }

.legal-part { margin-top: var(--s-64); padding-top: var(--s-32); border-top: 1px solid var(--line-strong); }

.legal-clause { display: grid; grid-template-columns: 48px minmax(0, 1fr); }
.legal-clause + .legal-clause { margin-top: var(--s-16); }
.legal-no { color: var(--ink-2); }
@media (min-width: 768px) { .legal-clause + .legal-stack { margin-left: 48px; } }   /* a block under a clause lines up with the clause text, not the number */
.legal-cl > * + * { margin-top: var(--s-16); }

/* ============================================================ 5. Plain-words panel, flow, steps, address, aside */
.legal-panel { padding: var(--s-24); }
.legal-panel > :first-child, .legal-address > :first-child { text-box: trim-start cap alphabetic; }   /* 24 of padding reads as 24, not 30 (harmless where unsupported) */
.legal-panel ul { list-style: none; padding: 0; }
.legal-panel li + li { margin-top: var(--s-12); }

.legal-flow { display: flex; align-items: center; gap: var(--s-16); }
.legal-flow-box {
  flex: 1; padding: var(--s-16) var(--s-24); border: 1px solid var(--line-strong); border-radius: 14px;
  text-align: center; font: 500 17px/24px var(--font-text); text-wrap: balance;
}
.legal-flow-arrow { color: var(--ink-2); }
@media (max-width: 479px) {
  .legal-flow { flex-direction: column; align-items: stretch; }
  .legal-flow-arrow { align-self: center; transform: rotate(90deg); }
}

.legal-example { padding: var(--s-24); }
.legal-example > .eyebrow + * { margin-top: var(--s-8); }
.legal-address { display: grid; gap: var(--s-4); padding: var(--s-24); }
.legal-aside { padding-top: var(--s-24); border-top: 1px solid var(--line-strong); }
.legal-aside > * + * { margin-top: var(--s-16); }

/* ============================================================ 6. Tables */
.legal .table td, .legal .table th { vertical-align: top; }
.legal .table th { white-space: nowrap; }
.legal .table td { padding-right: var(--s-16); }
.legal .table td:last-child { padding-right: 0; min-width: 7.5em; }
.legal-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; border: 0;
  clip-path: inset(50%); white-space: nowrap;
}
/* Wide tables (four or five columns) cannot sit in a 680 column: every row becomes a small block, the column name above each value. */
.legal-stack > .table { min-width: 0; }
.legal-stack .table, .legal-stack tbody, .legal-stack tr, .legal-stack th, .legal-stack td { display: block; }
.legal-stack tr { padding: var(--s-24) 0; border-bottom: 1px solid var(--line); }
.legal-stack tbody tr:first-child { border-top: 1px solid var(--line-strong); }
.legal-stack .table tbody th { padding: 0; border: 0; color: var(--ink); font: 500 17px/24px var(--font-text); white-space: normal; }
.legal-stack .table td { padding: 0; margin-top: var(--s-12); border: 0; }
.legal-stack td::before { content: attr(data-label); display: block; margin-bottom: var(--s-4); color: var(--ink-2); font: 500 13px/16px var(--font-text); }
.legal-stack td:empty { display: none; }

/* Column widths where the auto layout gave the shortest text the widest column (the head cells are sr-only or short, so nowrap is safe). */
@media (min-width: 768px) {
  :is(.legal-w-collect, .legal-w-others, .legal-w-annex) > .table { table-layout: fixed; }
  .legal-w-collect th:nth-child(1) { width: 38%; } .legal-w-collect th:nth-child(2) { width: 28%; } .legal-w-collect th:nth-child(3) { width: 34%; }
  .legal-w-others th:nth-child(1) { width: 46%; } .legal-w-others th:nth-child(2) { width: 34%; } .legal-w-others th:nth-child(3) { width: 20%; }
  .legal-w-annex th:nth-child(1) { width: 55%; } .legal-w-annex th:nth-child(2) { width: 45%; }
}
/* The cookie list: no hairline right under the heading (it read as an underline on it); from 768 up each cookie is its title with the label on the
   left and the answer on the right, so the same four labels read down the rows. */
.legal-rows tbody tr:first-child { padding-top: 0; border-top: 0; }
@media (min-width: 768px) {
  .legal-rows .table td:not(:empty) { display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: var(--s-24); align-items: baseline; margin-top: var(--s-8); }
  .legal-rows .table td::before { margin-bottom: 0; }
  .legal-rows .table tbody th + td { margin-top: var(--s-12); }
}

/* ============================================================ 7. End block, placeholders */
.legal-end { margin-top: var(--s-48); padding-top: var(--s-24); border-top: 1px solid var(--line); }
.legal-end > * + * { margin-top: var(--s-12); }
.legal-end .legal-related { display: grid; justify-content: start; gap: var(--s-8) var(--s-24); margin-top: var(--s-16); }
@media (min-width: 768px) { .legal-end .legal-related { grid-template-columns: repeat(2, auto); } }
@media (min-width: 768px) and (pointer: fine) { .legal-body .link-arrow { min-height: 24px; } }   /* at least a 24 target with a mouse (the 44 on a phone or tablet in the hand comes from site.css) */
.legal .todo { overflow-wrap: anywhere; }                     /* long placeholders wrap inside the reading column; the look is the shared .todo */

/* ============================================================ 8. The 404 page */
.nf-links { display: grid; gap: var(--s-24); margin-top: var(--s-48); }
.nf-link { display: flex; align-items: center; justify-content: space-between; gap: var(--s-12); }
.nf-text { display: grid; gap: var(--s-4); min-width: 0; }                  /* the name, then its one line of purpose */
.nf-link .ic { flex: none; color: var(--ink-2); transition: transform var(--d-hover) var(--ease); }
@media (hover: hover) { .nf-link:hover .ic { transform: translateX(var(--arrow-go)); } }
.nf-link:active .ic { transform: translateX(var(--arrow-go)); }
.nf h1 { margin-top: var(--s-12); }
@media (min-width: 480px) { .nf-links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .nf-links { grid-template-columns: repeat(4, minmax(0, 1fr)); } }          /* four across only where each card holds its purpose on one line */

/* ============================================================ 9. Phone and touch (phone pass, 13 Oct) */
/* Mono numerals take their size from the line they sit in (site.css, SYSTEM.md section 3); this page sets none. Only the line box is set here: a 13 Mono in a 20
   line made the 28 high contents rows 29 high. */
.legal .num { line-height: 1; }

/* The Grievance Officer's email is a 44 target (the related links at the foot get theirs from site.css, with the 8 between rows from .legal-related). */
@media (max-width: 767px), (pointer: coarse) { .legal-address a { display: inline-flex; align-items: center; min-height: 44px; } }

/* A table with its own header row (no stacked variant in the markup) becomes small blocks on a phone, the column name above each value:
   reading legal text sideways in a frame is the worst way to read it. The labels are data-label attributes on the cells. */
@media (max-width: 767px) {
  .legal-phone-stack > .table { min-width: 0; }
  .legal-phone-stack .table, .legal-phone-stack tbody, .legal-phone-stack tr, .legal-phone-stack td { display: block; }
  .legal-phone-stack thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  .legal-phone-stack thead tr, .legal-phone-stack thead th { display: block; padding: 0; white-space: normal; }
  .legal-phone-stack tr { padding: var(--s-24) 0; border-bottom: 1px solid var(--line); }
  .legal-phone-stack tbody tr:first-child { border-top: 1px solid var(--line-strong); }
  .legal-phone-stack .table tbody td:first-child { padding: 0; border: 0; color: var(--ink); font: 500 17px/24px var(--font-text); }
  .legal-phone-stack .table td + td { padding: 0; margin-top: var(--s-12); border: 0; }
  .legal-phone-stack td[data-label]::before { content: attr(data-label); display: block; margin-bottom: var(--s-4); color: var(--ink-2); font: 500 13px/16px var(--font-text); }
}

/* A clause on a phone: the number is a 13px grey line above the run-in title instead of a 48px column beside it (the measure goes from 310 to 358). */
@media (max-width: 767px) {
  .legal-clause { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); }
  .legal .legal-no { font-size: 13px; line-height: 16px; }
  .legal-cl :is(ul, ol) { padding-left: var(--s-16); }
}
