/* What The Food — legal pages. All presentation here. */

:root {
  color-scheme: light dark;
  --ink: light-dark(#14120f, #f3f0e8);
  --muted: light-dark(#5e584f, #b7b1a6);
  --paper: light-dark(#f6f5f2, #11110f);
  --hair: light-dark(rgba(20, 18, 15, 0.1), rgba(255, 255, 255, 0.12));
  --surface: light-dark(#ffffff, #1c1c1a);
  --accent: light-dark(#0f7a4c, #3dce8c);
  --measure: 42rem;
  --gutter: 1.375rem;
  --radius: 0.75rem;
}

:root[data-theme="light"] {
  color-scheme: only light;
}

:root[data-theme="dark"] {
  color-scheme: only dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--paper);
  font-size: 1.0625rem;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* —— Chrome (same rhythm as landing) —— */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.375rem;
  border-bottom: 1px solid var(--hair);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
}

.site-logo img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: none;
}

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.theme-toggle span {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* —— Document —— */

.legal {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
  padding-block: 3rem 5rem;
}

.doc-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hair);
}

.doc-header h1 {
  margin: 0 0 0.625rem;
  font-size: clamp(2rem, 3.5vw + 1rem, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.doc-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.legal :is(h2, h3) {
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.legal h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.3125rem;
  line-height: 1.25;
  scroll-margin-top: 5rem;
}

.legal h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.0625rem;
  line-height: 1.3;
  color: var(--muted);
  font-weight: 600;
}

.legal :is(p, ul, ol) {
  margin: 0 0 1.05rem;
}

.legal :is(ul, ol) {
  padding-left: 1.2rem;
}

.legal li + li {
  margin-top: 0.4rem;
}

.legal li::marker {
  color: var(--muted);
}

.doc-toc {
  margin: 0 0 2.5rem;
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--surface);
}

.doc-toc h2 {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-toc ol {
  margin: 0;
  padding-left: 1.2rem;
  columns: 1;
}

@media (min-width: 40rem) {
  .doc-toc ol {
    columns: 2;
    column-gap: 1.5rem;
  }
}

.doc-toc li {
  break-inside: avoid;
}

.doc-toc li + li {
  margin-top: 0.3rem;
}

.doc-toc a {
  color: var(--ink);
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--accent);
  text-decoration: none;
}

.doc-callout {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--hair);
  border-left: 3px solid var(--accent);
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.doc-callout > :last-child {
  margin-bottom: 0;
}

.doc-address {
  margin: 1.15rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--surface);
  font-style: normal;
}

.doc-address p {
  margin: 0.3rem 0;
}

.doc-address p:first-child {
  margin-top: 0;
}

.doc-address p:last-child {
  margin-bottom: 0;
}

/* —— Site footer (home, legal, 404 — same chrome) —— */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
  margin-top: 0;
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--hair);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
}

.site-footer-entity {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.site-footer-entity p {
  margin: 0;
}

.site-footer-app {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-footer-entity strong {
  font-weight: 600;
  color: var(--ink);
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1.25rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: none;
}

.site-footer-copy {
  margin: 0;
  font-size: 0.8125rem;
  opacity: 0.85;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  font-size: 0.9em;
}
