/* The published legal documents at /privacy and /terms.
 *
 * Its own stylesheet rather than an extension of `public/base.html`: that base
 * centres its text in a 40rem column, which is right for a star rating on a
 * phone and wrong for several thousand words of prose. Measure, alignment and
 * heading rhythm here are chosen for reading.
 */

:root {
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--brand-text, #333333);
  background: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.legal-header {
  border-bottom: 1px solid #e2e6eb;
}

.legal-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.25rem;
  width: min(calc(100% - 2.5rem), 48rem);
  margin: 0 auto;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--brand-text, #333333);
  font-size: 1.1rem;
  font-weight: 720;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.legal-brand-logo {
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  border-radius: 0.7rem;
  object-fit: cover;
}

.legal-brand-primary { color: var(--brand-primary, #155aa3); }
.legal-brand-accent { color: var(--brand-secondary, #f37021); }

/* The reading column. 48rem is roughly 75 characters at this size. */
.legal-main {
  width: min(calc(100% - 2.5rem), 48rem);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) 0 1rem;
  overflow-wrap: anywhere;
}

.legal-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.9rem 0 0;
  color: var(--brand-text-muted, #757575);
  font-size: 0.86rem;
}

.legal-summary {
  margin: 1.5rem 0 0;
  padding: 1.1rem 1.25rem;
  border-left: 4px solid var(--brand-secondary, #f37021);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--brand-secondary-soft, #fdf1e8);
  font-size: 1.02rem;
}

/* Section numbering comes from the counter, not from the text: renumbering a
   document then means moving one Section, never editing a dozen headings. */
.legal-sections {
  counter-reset: legal-section;
  margin: 2.5rem 0 0;
}

.legal-section {
  margin: 0 0 2.25rem;
}

.legal-section h2 {
  counter-increment: legal-section;
  margin: 0 0 0.7rem;
  font-size: 1.22rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.legal-section h2::before {
  content: counter(legal-section) ". ";
  color: var(--brand-primary, #155aa3);
  font-variant-numeric: tabular-nums;
}

.legal-section p {
  margin: 0 0 0.9rem;
}

.legal-section ul {
  margin: 0 0 0.9rem;
  padding-left: 1.3rem;
}

.legal-section li {
  margin-bottom: 0.5rem;
}

.legal-section p:last-child,
.legal-section ul:last-child {
  margin-bottom: 0;
}

.legal-contact {
  margin: 2.5rem 0 0;
  padding: 1.25rem 1.4rem;
  border: 1px solid #e2e6eb;
  border-radius: 0.8rem;
  background: #f8fafd;
}

.legal-contact h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #0f172a;
}

.legal-contact p { margin: 0; }

a { color: var(--brand-primary, #155aa3); }

a:focus-visible {
  outline: 3px solid rgba(21, 90, 163, 0.28);
  outline-offset: 3px;
}

@media (max-width: 40rem) {
  .legal-nav,
  .legal-main {
    width: min(calc(100% - 2rem), 48rem);
  }
}

/* --- added for the long-form documents ---------------------------------- */

.legal-preamble {
  margin: 1.1rem 0 0;
  color: var(--brand-text-muted, #757575);
  font-size: 0.95rem;
}

/* Contents. A document of this length is unusable without one, and a reader
   who was sent a link about one clause should not have to scroll for it. */
.legal-toc {
  margin: 2.25rem 0 0;
  padding: 1.25rem 1.4rem;
  border: 1px solid #e2e6eb;
  border-radius: 0.8rem;
  background: #f8fafd;
}

.legal-toc h2 {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text-muted, #757575);
}

.legal-toc ol {
  margin: 0;
  padding-left: 1.4rem;
  columns: 2;
  column-gap: 2rem;
}

.legal-toc li {
  margin-bottom: 0.4rem;
  break-inside: avoid;
  font-size: 0.94rem;
}

.legal-toc a { text-decoration: none; }
.legal-toc a:hover { text-decoration: underline; }

/* An anchored section must not land under the top of the viewport. */
.legal-section { scroll-margin-top: 1.5rem; }

.legal-section dl {
  margin: 0 0 0.9rem;
}

.legal-section dt {
  margin-top: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.legal-section dd {
  margin: 0.2rem 0 0;
}

/* Tables carry the statutory category list and the purpose/legal-basis grid.
   Wide content scrolls inside its own box rather than pushing the page sideways
   on a phone. */
.legal-table-wrap {
  margin: 1.1rem 0;
  overflow-x: auto;
  border: 1px solid #e2e6eb;
  border-radius: 0.6rem;
}

.legal-section table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.legal-section caption {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e2e6eb;
  background: #f8fafd;
  color: var(--brand-text-muted, #757575);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.legal-section th,
.legal-section td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  vertical-align: top;
}

.legal-section thead th {
  background: #fbfcfe;
  font-size: 0.86rem;
  color: #0f172a;
}

.legal-section tbody th {
  font-weight: 650;
  color: #0f172a;
}

.legal-section tbody tr:last-child th,
.legal-section tbody tr:last-child td {
  border-bottom: 0;
}

.legal-back {
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
}

.legal-back a {
  color: var(--brand-text-muted, #757575);
  text-decoration: none;
}

.legal-back a:hover { text-decoration: underline; }

.legal-other-document { margin-top: 0.6rem; }

@media (max-width: 40rem) {
  .legal-toc ol { columns: 1; }
}

@media print {
  .legal-header,
  .legal-toc,
  .legal-back,
  .site-footer { display: none; }
  .legal-main { width: 100%; }
  .legal-section { break-inside: avoid-page; }
}
