/* Legal documents (pages/legal/*, generated by legal/build.py).
   Sources for the choices below:
   - CutQ brand guide (assets/CutQ Brand Guide/brand-guide.html): Outfit 400–700,
     h2 22px/700/-0.02em, h3 700/-0.01em, ink #111 on white, greys #e5e5e5/#fafafa,
     Ultramarine on the selected tab, the current item in a list, links and the
     focus ring — nowhere else (never headings, body, backgrounds or buttons).
   - Booksy's terms page (booksy.com/en-us/p/terms, 24 Sep 2026): 16px body on a
     28px line, 36px title, numbered sentence-case section headings, a list of
     legal documents with the current one marked by an accent bar.
   - Fresha's terms (terms.fresha.com, 24 Sep 2026): document tabs across the top,
     current one underlined; a collapsible terms index; links in the accent colour.
   - WCAG 1.4.8 (≤ 80 characters a line), 1.4.1 (links not by colour alone:
     underlined), 2.4.7 (visible focus), 2.5.8 (targets ≥ 24px); Apple HIG /
     Material 3 tabs (≥ 44–48px touch height).
   Muted text uses --text-tertiary (#757575, 4.6:1) — the guide's #888 is 3.5:1
   and fails AA at body sizes. */

.legal-page {
  --legal-accent: var(--brand-accent);
  --legal-muted: var(--text-tertiary);
  --legal-rule: var(--border-light);
  --legal-wash: var(--bg-tertiary);
  --legal-aside: 232px;
  --legal-gap: 64px;
  --legal-measure: 560px; /* ≈ 80 characters of Outfit at 16px */
}

.legal-skip {
  position: absolute;
  left: -9999px;
}
.legal-skip:focus {
  left: var(--space-4);
  top: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--text-primary);
  color: #FFFFFF;
  border-radius: 8px;
}

.legal-page a:focus-visible,
.legal-page summary:focus-visible {
  outline: 2px solid var(--legal-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Document tabs ───────────────────────────────────────────── */
.legal-tabs {
  border-bottom: 1px solid var(--legal-rule);
  background: #FFFFFF;
}
.legal-tabs ul {
  display: flex;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative; /* offsetParent for centring the current tab */
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.legal-tabs ul::-webkit-scrollbar { display: none; }
.legal-tabs li { flex: none; }
.legal-tabs a {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--legal-muted);
  text-decoration: none;
  white-space: nowrap;
}
.legal-tabs a:hover { color: var(--text-primary); }
.legal-tabs a[aria-current="page"] {
  color: var(--text-primary);
  border-bottom-color: var(--legal-accent);
}

/* ── Title ───────────────────────────────────────────────────── */
.legal {
  padding: var(--space-8) 0 var(--space-16);
}
.legal-head {
  margin-bottom: var(--space-6);
}
.legal-head h1 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.04em;
  line-height: var(--lh-tight);
  color: var(--text-primary);
}
.legal-meta {
  margin: 0;
  font-size: 14px;
  color: var(--legal-muted);
}
.legal-meta-sep { margin: 0 var(--space-2); }
.legal-meta a,
.legal-top a {
  color: var(--legal-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Contents ────────────────────────────────────────────────── */
.legal-toc {
  margin-bottom: var(--space-6);
  border: 1px solid var(--legal-rule);
  border-radius: 12px;
}
.legal-toc summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-4);
  font-size: 15px;
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
}
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--text-primary);
  border-bottom: 2px solid var(--text-primary);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}
.legal-toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.legal-toc-count {
  font-weight: var(--fw-regular);
  color: var(--legal-muted);
}
.legal-toc ol {
  margin: 0;
  padding: 0 var(--space-4) var(--space-3);
  list-style: none;
}
.legal-toc a {
  display: block;
  padding: 6px 0 6px var(--space-3);
  border-left: 2px solid var(--legal-rule);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-decoration: none;
}
.legal-toc a:hover { color: var(--text-primary); }
.legal-toc a[aria-current="location"] {
  border-left-color: var(--legal-accent);
  color: var(--legal-accent);
  font-weight: var(--fw-medium);
}

/* ── Body text ───────────────────────────────────────────────── */
.legal-body {
  max-width: var(--legal-measure);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  overflow-wrap: break-word;
}
.legal-body > :first-child { margin-top: 0; }
.legal-body h2 {
  margin: var(--space-12) 0 var(--space-3);
  font-size: 22px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: 1.3;
  scroll-margin-top: 96px;
}
.legal-body h3 {
  margin: var(--space-8) 0 var(--space-2);
  font-size: 16px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  line-height: 1.4;
  scroll-margin-top: 96px;
}
/* main.css sets every <p> to #333; the brand asks for ink on white. */
.legal-body p,
.legal-body li,
.legal-body td { color: var(--text-primary); }
.legal-body p { margin: 0 0 var(--space-4); }
.legal-body ul,
.legal-body ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-6);
}
.legal-body ul { list-style: disc; }
.legal-body ol { list-style: decimal; }
.legal-body li { margin-bottom: var(--space-2); }
.legal-body li::marker { color: var(--text-primary); }
.legal-body a {
  color: var(--legal-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.legal-body a:hover { text-decoration-thickness: 2px; }
.legal-body strong { font-weight: var(--fw-bold); }
.legal-body address {
  margin: 0 0 var(--space-4);
  font-style: normal;
}
.legal-body [id] { scroll-margin-top: 96px; }

/* "In short" summaries (privacy policy) */
.legal-body .legal-short {
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  background: var(--legal-wash);
}

/* Clauses that must be drawn to the reader's attention (CPA s49) — in sentence
   case in a ruled box, rather than capitals, which read more slowly. */
.legal-notice {
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--text-primary);
  border-radius: 12px;
}
.legal-notice p:last-child { margin-bottom: 0; }
.legal-body .legal-notice-label {
  margin: 0 0 var(--space-1);
  font-size: 12px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
}

/* Tables scroll inside themselves on a phone rather than widening the page. */
.legal-table {
  margin: 0 0 var(--space-4);
  overflow-x: auto;
}
.legal-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: var(--lh-normal);
}
.legal-body th,
.legal-body td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--legal-rule);
  text-align: left;
  vertical-align: top;
}
.legal-body th {
  background: var(--legal-wash);
  font-weight: var(--fw-bold);
}

.legal-top {
  margin: var(--space-12) 0 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--legal-rule);
  font-size: 14px;
}

/* ── Wide screens: contents becomes a sticky column ──────────── */
@media (min-width: 1024px) {
  /* Tabs, contents and text share one centred column, so the page lines up
     from the tab row down. */
  .legal .container,
  .legal-tabs .container {
    max-width: calc(var(--legal-aside) + var(--legal-gap) + var(--legal-measure) + 2 * var(--container-padding));
    box-sizing: border-box;
  }
  .legal-head {
    margin-left: calc(var(--legal-aside) + var(--legal-gap));
    margin-bottom: var(--space-10);
  }
  .legal-head h1 { font-size: 36px; }
  .legal-grid {
    display: grid;
    grid-template-columns: var(--legal-aside) minmax(0, 1fr);
    column-gap: var(--legal-gap);
    align-items: start;
  }
  .legal-grid--single .legal-body { grid-column: 2; }
  .legal-toc {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .legal-toc summary {
    min-height: 0;
    padding: 0 0 var(--space-3);
    font-size: 13px;
    cursor: default;
    pointer-events: none;
  }
  .legal-toc summary::after,
  .legal-toc-count { display: none; }
  .legal-toc ol { padding: 0; }
  .legal-toc a { font-size: 13px; }
}

/* ── The PDF: the document alone, A4 ─────────────────────────── */
@page {
  size: A4;
  margin: 20mm 18mm;
}
@media print {
  .site-header,
  .site-footer,
  .legal-skip,
  .legal-tabs,
  .legal-top,
  .legal-meta-sep,
  .legal-meta a,
  .legal-toc summary::after,
  .legal-toc-count {
    display: none !important;
  }
  body { background: #FFFFFF; }
  .legal { padding: 0; }
  .legal .container { padding: 0; max-width: none; }
  .legal-head { margin: 0 0 12pt; }
  .legal-head h1 { font-size: 22pt; }
  .legal-grid { display: block; }
  .legal-body { max-width: none; font-size: 10.5pt; line-height: 1.55; }
  .legal-body h2 { font-size: 13pt; margin-top: 18pt; break-after: avoid; }
  .legal-body h3 { font-size: 11pt; break-after: avoid; }
  .legal-toc { position: static; max-height: none; border: 0; margin-bottom: 12pt; }
  .legal-toc summary { padding: 0 0 4pt; min-height: 0; font-size: 11pt; }
  .legal-toc ol { padding: 0; }
  .legal-toc a { border: 0; padding: 1pt 0; font-size: 10pt; color: var(--text-primary); }
  .legal-notice, .legal-body tr, .legal-body li { break-inside: avoid; }
}

/* A button inside the text (account deletion's email request) keeps the
   brand's primary button: ink fill, white label — never the accent. */
.legal-body a.btn {
  color: #FFFFFF;
  text-decoration: none;
}
.legal-body a.btn:hover { color: #FFFFFF; }
