/* heliva.app legal pages. Layout from Lumural's legal template
   (~/code/whiteboard/docs/legal-handoff/README.md); colours from the app's
   Palette.swift; type from ADR-0009. A legal page is paper: no cards, no
   shadows, hairline rules. */

@font-face {
  font-family: 'Familjen Grotesk';
  src: url('/fonts/FamiljenGrotesk-Variable.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('/fonts/DMMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --ground: #f2ede3;
  --ink: #12332b;
  --ink-muted: #4e655c;
  --rule: #d8cebb;
  --rule-strong: #b9ae98;
  --accent: #8f5409;
  --mark: #f2a93b55;
  --words: 'Familjen Grotesk', system-ui, sans-serif;
  --numbers: 'DM Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12332b;
    --ink: #f2ede3;
    --ink-muted: #a8bbb2;
    --rule: #2a5246;
    --rule-strong: #3a6a5b;
    --accent: #f2a93b;
    --mark: #f2a93b44;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 18px/1.7 var(--words);
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px solid var(--rule-strong);
}
a:hover {
  border-bottom-color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 16px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
}
main {
  max-width: 68ch;
  min-width: 0;
}

/* Header */
.eyebrow {
  margin: 0 0 12px;
  font: 12px/1.4 var(--numbers);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
}
.standfirst {
  margin: 0 0 20px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 58ch;
}
.meta {
  margin: 0;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  font: 12.5px/1.5 var(--numbers);
  color: var(--ink-muted);
}

/* Sections */
section {
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type {
  border-bottom: 0;
}
h2 {
  display: flex;
  gap: 16px;
  align-items: baseline;
  margin: 0 0 16px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
}
h2 .num {
  font: 13px/1 var(--numbers);
  color: var(--ink-muted);
}
section p {
  margin: 0 0 16px;
  text-wrap: pretty;
}
section ul,
section ol {
  margin: 0 0 16px;
  padding-left: 24px;
}
section li {
  margin-bottom: 12px;
  padding-left: 4px;
}
section ul li::marker {
  color: var(--ink-muted);
}
section > :last-child {
  margin-bottom: 0;
}
strong {
  font-weight: 600;
}
mark.todo {
  background: var(--mark);
  color: inherit;
  padding: 0 4px;
  border-radius: 3px;
  font: 0.8em var(--numbers);
}

/* Tables scroll inside their own box on a phone, never the page. */
.table {
  overflow-x: auto;
  margin: 0 0 16px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  line-height: 1.5;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--rule);
}
th {
  font: 12px/1.4 var(--numbers);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 400;
}
thead th:empty {
  padding: 0;
}
td:first-child {
  min-width: 9em;
}

/* Aside */
aside ul,
aside ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
aside a {
  border: 0;
  color: var(--ink-muted);
}
aside a:hover {
  color: var(--accent);
}
.docs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 15px;
}
.docs a[aria-current='page'] {
  color: var(--ink);
  font-weight: 500;
}
.toc {
  display: none;
}
.toc li {
  margin-bottom: 9px;
  font-size: 15px;
  line-height: 1.4;
}
.toc a {
  display: flex;
  gap: 10px;
}
.toc .num {
  flex: 0 0 18px;
  font: 12px/1.6 var(--numbers);
}

footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  font: 12.5px/1.5 var(--numbers);
  color: var(--ink-muted);
}

/* At 1000px and up the aside sits on the left and stays put. The document
   comes first in the source, so on a phone it is the first thing you see. */
@media (min-width: 1000px) {
  .shell {
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 72px;
    padding: 64px 32px 32px;
    align-items: start;
  }
  main {
    order: 2;
  }
  aside {
    order: 1;
    position: sticky;
    top: 32px;
  }
  .docs {
    display: block;
  }
  .docs li {
    padding: 11px 0;
    border-bottom: 1px solid var(--rule);
  }
  .toc {
    display: block;
    margin-top: 32px;
  }
  footer {
    padding-left: calc(32px + 232px + 72px);
  }
}

@media print {
  :root {
    --ground: #fff;
    --ink: #000;
    --ink-muted: #444;
    --rule: #ccc;
  }
  aside,
  footer {
    display: none;
  }
  .shell {
    display: block;
    padding: 0;
  }
  main {
    max-width: none;
  }
  body {
    font-size: 11pt;
  }
  section {
    break-inside: avoid-page;
  }
  main a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
  }
}
