/* Privacy + Terms: hero, review notice, TOC rail, article type. Tokens only. */

.legal-hero h1 {
  font-size: var(--step-5);
  font-stretch: var(--wdth-wide);
}

.legal-hero__meta {
  margin-block-start: var(--space-xs);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

/* Dashed = a piece still to be supplied; deliberately not a status colour. */
.legal-notice {
  display: flex;
  gap: var(--space-s);
  align-items: flex-start;
  max-inline-size: var(--measure);
  margin-block-start: var(--space-m);
  padding: var(--space-s) var(--space-m);
  border: 2px dashed var(--graphite);
  border-radius: var(--radius-m);
}

.legal-notice__icon {
  flex: none;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  color: var(--color-text);
}

.legal-notice__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: var(--fw-title);
}

.legal-notice__text {
  margin: var(--space-3xs) 0 0;
  font-size: var(--step--1);
}

/* ---------- TOC rail ---------- */
.legal-toc__title {
  margin: 0;
  font-size: var(--step-0);
  font-weight: var(--fw-title);
}

.legal-toc__link {
  display: flex;
  align-items: center;
  min-block-size: 2.75rem;
  padding: var(--space-2xs) var(--space-s);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: var(--fw-label);
  font-stretch: var(--wdth-label);
  color: var(--color-text);
  text-decoration: none;
  transition: background-color var(--dur-micro) var(--ease-out);
}

.legal-toc__link:hover {
  background: var(--color-surface-raised);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* Two columns from 640px come from .rail--grid; the sidebar from 1024px is one column. */
@media (min-width: 1024px) {
  .legal-toc__list {
    --rail-cols: 1;
  }
}

@media (min-width: 1024px) and (min-height: 56rem) {
  .legal-toc {
    position: sticky;
    inset-block-start: calc(var(--header-h) + var(--space-l));
    align-self: start;
    max-block-size: calc(100vh - var(--header-h) - var(--space-2xl));
    overflow-y: auto;
  }
}

/* ---------- Article ---------- */
.legal-content {
  min-inline-size: 0;
  overflow-wrap: anywhere;
  line-height: var(--lh-body);
}

.legal-content > section + section {
  margin-block-start: var(--space-xl);
}

.legal-content h2 {
  position: relative;
  /* Not a rail cell, so R0's .rail > * rule does not reach it. */
  max-inline-size: none;
  margin-block-end: var(--space-s);
  font-size: var(--step-2);
  font-weight: var(--fw-heading);
  font-stretch: var(--wdth-wide);
  line-height: var(--lh-heading);
}

.legal-content h3 {
  margin-block: var(--space-m) var(--space-2xs);
  font-size: var(--step-1);
  font-weight: var(--fw-title);
  font-stretch: var(--wdth-label);
}

.legal-content p,
.legal-content ul,
.legal-content li {
  max-inline-size: var(--measure);
}

.legal-content ul {
  padding-inline-start: var(--space-m);
}

.legal-content li + li {
  margin-block-start: var(--space-2xs);
}

.legal-content code {
  padding: 0 0.25em;
  font-family: inherit;
  font-weight: var(--fw-label);
  background: var(--color-surface-raised);
  border: 1px solid var(--pegboard);
  border-radius: var(--radius-s);
}

/* Jump marker: a cyan bar seats in the gutter beside the targeted heading. */
.legal-content h2:target::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(var(--space-s) * -1);
  inline-size: 3px;
  background: var(--signal-cyan);
  transform-origin: top;
  animation: legal-peg var(--dur-snap) var(--ease-snap) both;
}

@keyframes legal-peg {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

.legal-content__footer {
  margin-block-start: var(--space-xl);
}

/* Ghost key padding (space-m + 2px border) is cancelled so the text meets the column edge,
   capped so the 3px focus ring stays inside the viewport on small screens. */
.legal-content__footer > .btn:first-child {
  margin-inline-start: max(
    calc((var(--space-m) + 2px) * -1),
    calc((var(--gutter) - 0.5rem) * -1)
  );
}

@media print {
  .legal-toc,
  .legal-content__footer {
    display: none;
  }

  .legal-layout {
    display: block;
  }
}
