/* Legal pages (privacy.html, terms.html): one long-form template. The table of contents is sticky
   with a scroll-spy star on desktop and an "On this page" disclosure (the EE.ui accordion) below 1024px. */
.legal { padding-block: calc(var(--header-h) + var(--space-8)) var(--section-pad); }
.legal:focus { outline: none; }
.legal__head { display: grid; gap: var(--space-5); justify-items: start; margin-bottom: clamp(var(--space-7), 6vw, var(--space-9)); }
.legal__title { max-width: 16ch; }
.legal__meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: 0; }
.legal__meta div { display: flex; align-items: baseline; gap: var(--space-3); }
.legal__meta dt { font: 400 var(--fs-mono) / 1.5 var(--font-mono); letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--text-muted); }
.legal__meta dd { margin: 0; font-size: var(--fs-small); font-weight: 500; }
.legal__notice { max-width: 64ch; }

.legal__layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-7) var(--gutter); align-items: start; }
.legal-toc { grid-column: 1 / span 3; min-width: 0; }
.legal__body { grid-column: 5 / span 8; min-width: 0; }

/* Table of contents. The list keeps a 6px margin so the current-item star and the focus ring are not
   clipped by the accordion body (overflow: hidden). */
.legal-toc__item { border: 0; }
.legal-toc__trigger { display: none; }
.legal-toc__label { margin: 0 0 var(--space-3) 6px; }
.legal-toc .accordion__body > * { max-width: none; padding-bottom: 0; color: inherit; }
.legal-toc__list { display: grid; margin: 6px; border-left: 1px solid var(--line); }
.legal-toc__link {
  position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); align-items: baseline;
  min-height: 36px; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  font-size: var(--fs-small); line-height: 1.4; color: var(--text-muted); text-decoration: none;
  transition: color var(--dur-fast) ease;
}
@media (hover: hover) {
  .legal-toc__link:hover { color: var(--text); }
}
.legal-toc__link::before {
  content: ''; position: absolute; left: -5px; top: 50%; width: 9px; height: 9px;
  background: var(--gold-500);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  translate: 0 -50%; transform: scale(0);
  transition: transform var(--dur-base) var(--ease-out-expo);
}
.legal-toc__link[aria-current='true'] { color: var(--text); font-weight: 500; }
.legal-toc__link[aria-current='true']::before { transform: scale(1); }
.legal-toc__num { color: var(--gold-700); }

/* Sections: numbered Caslon headings over a clearly marked placeholder block */
.legal-section { display: grid; gap: var(--space-5); padding-block: var(--space-7); border-top: 1px solid var(--line); }
.legal-section:first-child { padding-top: 0; border-top: 0; }
.legal-section__title { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: baseline; font-size: var(--fs-h3); }
.legal-section__num { font-size: var(--fs-mono); color: var(--gold-700); }
.legal-placeholder {
  display: grid; gap: var(--space-3); max-width: 64ch; margin-left: 3rem;
  padding: var(--space-5); background: var(--card);
  border: 1px dashed var(--gold-500); border-radius: var(--radius-field);
}
.legal-placeholder__tag { color: var(--gold-700); }
.legal-placeholder__scope { font-size: var(--fs-small); color: var(--text-muted); }
.legal__outro { margin: var(--space-7) 0 0 3rem; color: var(--text-muted); }

@media (min-width: 1024px) {
  .legal-toc { position: sticky; top: calc(var(--header-h) + var(--space-5)); }
  /* The disclosure is always open here: the list is the sticky navigation */
  .legal-toc[data-accordion][data-ready] .accordion__panel:not([data-state='open']) { grid-template-rows: 1fr; visibility: visible; }
}
@media (max-width: 1023px) {
  .legal__layout { gap: var(--space-6); }
  .legal-toc, .legal__body { grid-column: 1 / -1; }
  html.js .legal-toc { padding-inline: var(--space-4); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-field); }
  html.js .legal-toc__trigger { display: flex; padding: var(--space-4) var(--space-1); border-radius: var(--radius-field); }
  html.js .legal-toc__label { display: none; }
  html.js .legal-toc__list { margin-bottom: var(--space-4); }
}
@media (max-width: 767px) {
  .legal-section__title { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .legal-placeholder, .legal__outro { margin-left: 0; }
}

/* Printing a policy: the text only */
@media print {
  .site-header, .site-footer, .cookie-banner, .page-curtain, .skip-link, .legal-toc { display: none; }
  .legal { padding-block: 0; }
  .legal__layout { display: block; }
  .legal-section { break-inside: avoid; }
}
