/* Shared styling for CARLOG's static legal pages (privacy.html, terms.html, cookies.html,
   changelog.html). Reuses the EXACT same semantic color tokens as index.html (not a second
   theme system) — see the inline boot script in each page's <head> for how --data-theme
   gets resolved before first paint, and window.__carlogApplyTheme() for how the Appearance
   control below changes it. */

:root {
  --bg: #f7f7f4; --bg-secondary: #faf9f5;
  --surface: #ffffff; --surface-secondary: #f2f1ec;
  --text-primary: #26251e; --text-secondary: #55534b; --text-muted: #77746a; --text-faint: #a09c8c;
  --border: #e6e5e0; --divider: #efeeea;
  --accent: #f54e00; --accent-hover: #d04200;
  --note-bg: #faf4e4; --note-border: #e3d6b4; --note-text: #6b5420; --note-code: #8b6310;
  --tag-feature-fg: #1f7a4d; --tag-feature-bg: #e6f2eb;
  --tag-fix-fg: #a8620a; --tag-fix-bg: #faf0e0;
  --tag-improved-fg: #2563a8; --tag-improved-bg: #e5eefa;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16150f; --bg-secondary: #1b1a14;
    --surface: #201f19; --surface-secondary: #26251e;
    --text-primary: #f2f1ec; --text-secondary: #c9c6ba; --text-muted: #948f80; --text-faint: #6d6a5e;
    --border: #3a382e; --divider: #302f27;
    --accent: #f54e00; --accent-hover: #ff6a1f;
    --note-bg: #2b2210; --note-border: #4a3a17; --note-text: #d9b877; --note-code: #d9b877;
    --tag-feature-fg: #6fbf8a; --tag-feature-bg: #16261c;
    --tag-fix-fg: #d9a35c; --tag-fix-bg: #2b2210;
    --tag-improved-fg: #6fa8d9; --tag-improved-bg: #17242c;
  }
}
:root[data-theme="dark"] {
  --bg: #16150f; --bg-secondary: #1b1a14;
  --surface: #201f19; --surface-secondary: #26251e;
  --text-primary: #f2f1ec; --text-secondary: #c9c6ba; --text-muted: #948f80; --text-faint: #6d6a5e;
  --border: #3a382e; --divider: #302f27;
  --accent: #f54e00; --accent-hover: #ff6a1f;
  --note-bg: #2b2210; --note-border: #4a3a17; --note-text: #d9b877; --note-code: #d9b877;
  --tag-feature-fg: #6fbf8a; --tag-feature-bg: #16261c;
  --tag-fix-fg: #d9a35c; --tag-fix-bg: #2b2210;
  --tag-improved-fg: #6fa8d9; --tag-improved-bg: #17242c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* brand mark — same real artwork as the main site (assets/carlog-mark*.png), swapped by
   theme rather than a text/glyph placeholder. See index.html's own .logo-mark rules for
   why two PNGs rather than one filtered image (the dark file's clock hand is genuinely
   white pixels, not an invertible tint). */
.logo-mark { display: inline-flex; flex: none; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-mark .logo-mark-dark { display: none; }
:root[data-theme="dark"] .logo-mark .logo-mark-light { display: none; }
:root[data-theme="dark"] .logo-mark .logo-mark-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-mark .logo-mark-light { display: none; }
  :root:not([data-theme="light"]) .logo-mark .logo-mark-dark { display: block; }
}

/* header */
.legal-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.legal-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.legal-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
}
.legal-brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; color: var(--text-primary); }
.legal-back { font-size: 14px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.legal-back:hover { color: var(--text-primary); }

/* main content */
.legal-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 28px 88px;
}
.legal-title { font-size: 34px; letter-spacing: -1px; margin: 0 0 8px; line-height: 1.15; color: var(--text-primary); }
.legal-updated {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); margin-bottom: 32px;
}
.legal-intro { font-size: 15.5px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 32px; }

.legal-toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 22px; margin-bottom: 40px;
}
.legal-toc-label {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px;
}
.legal-toc ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.legal-toc a { color: var(--text-primary); }
.legal-toc a:hover { color: var(--accent); }

.legal-section { margin-bottom: 34px; scroll-margin-top: 84px; }
.legal-section h2 {
  font-size: 20px; letter-spacing: -0.4px; margin: 0 0 12px; padding-top: 6px; color: var(--text-primary);
}
.legal-section h3 { font-size: 15.5px; margin: 20px 0 8px; color: var(--text-primary); }
.legal-section p { font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin: 0 0 14px; }
.legal-section ul, .legal-section ol.legal-list {
  margin: 0 0 14px; padding-left: 20px; font-size: 15px; line-height: 1.7; color: var(--text-secondary);
}
.legal-section li { margin-bottom: 4px; }
.legal-section strong { color: var(--text-primary); }

.legal-note {
  background: var(--note-bg); border: 1px solid var(--note-border); border-radius: 10px;
  padding: 14px 16px; font-size: 13.5px; line-height: 1.6; color: var(--note-text); margin: 0 0 14px;
}
.legal-config { font-family: 'JetBrains Mono', monospace; font-size: 0.92em; color: var(--note-code); background: var(--note-bg); padding: 1px 5px; border-radius: 4px; }

/* changelog entry tags (changelog.html) */
.cl-entry { margin-bottom: 44px; }
.cl-date { font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.4px; color: var(--text-faint); margin-bottom: 6px; }
.cl-entry h2 { font-size: 20px; letter-spacing: -0.4px; margin: 0 0 12px; color: var(--text-primary); }
.cl-tag {
  display: inline-flex; align-items: center; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; margin-right: 8px; vertical-align: 2px;
}
.cl-tag.feature { color: var(--tag-feature-fg); background: var(--tag-feature-bg); }
.cl-tag.fix { color: var(--tag-fix-fg); background: var(--tag-fix-bg); }
.cl-tag.improved { color: var(--tag-improved-fg); background: var(--tag-improved-bg); }
.cl-divider { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* appearance selector — compact, footer-anchored, doesn't compete visually with the legal
   links next to it */
.legal-appearance { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9999px; padding: 2px; }
.legal-appearance button {
  display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 9999px; border: none; background: none; color: var(--text-faint);
  font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
}
.legal-appearance button:hover { color: var(--text-secondary); }
.legal-appearance button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legal-appearance button[aria-pressed="true"] { background: var(--surface-secondary); color: var(--text-primary); }

/* footer */
.legal-footer { border-top: 1px solid var(--border); }
.legal-footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 32px 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 13px; color: var(--text-muted);
}
.legal-footer-copy { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.legal-footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.legal-footer-links a { color: var(--text-muted); padding: 4px 0; }
.legal-footer-links a:hover { color: var(--accent); }
.legal-footer-sep { color: var(--border); }
.legal-footer-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

@media (max-width: 700px) {
  .legal-header-inner { padding: 14px 20px; }
  .legal-main { padding: 36px 20px 64px; }
  .legal-title { font-size: 26px; }
  .legal-footer-inner { padding: 26px 20px; justify-content: flex-start; }
}
