/* Magnus theme tokens. Apps override tokens (never the component rules) in their own CSS.
   Theme resolution: [data-theme] on <html> (set by MagnusHtml.ThemeScript from localStorage "magnus.theme"),
   otherwise prefers-color-scheme. */
:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --bg-2: #efede6;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --line: #deddd6;
  --text: #1c1c1a;
  --text-2: #3d3d39;
  --muted: #6d6c66;
  --accent: #b5542a;
  --accent-ink: #ffffff;
  --link: #9a4322;
  --ok: #2f7d4a;
  --warn: #a86b00;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --radius: 10px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
  --gutter: 16px;
  --maxw: 1200px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121315;
  --bg-2: #17191c;
  --surface: #1c1f23;
  --surface-2: #23272c;
  --line: #2f343a;
  --text: #ecebe6;
  --text-2: #c9c8c2;
  --muted: #9a9993;
  --accent: #e0a458;
  --accent-ink: #1a1305;
  --link: #f0b877;
  --ok: #5cc27f;
  --warn: #e3b341;
  --bad: #f2716a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121315;
    --bg-2: #17191c;
    --surface: #1c1f23;
    --surface-2: #23272c;
    --line: #2f343a;
    --text: #ecebe6;
    --text-2: #c9c8c2;
    --muted: #9a9993;
    --accent: #e0a458;
    --accent-ink: #1a1305;
    --link: #f0b877;
    --ok: #5cc27f;
    --warn: #e3b341;
    --bad: #f2716a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
  }
}

html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font-sans); }
a { color: var(--link); }
.mk-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* Theme toggle button */
.mk-theme-toggle { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 10px; cursor: pointer; font: inherit; }

/* Footer */
.mk-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.mk-footer a { color: var(--muted); }
.mk-footer ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* Consent / notice bar */
.mk-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; display: none; gap: 12px; align-items: center; z-index: 50; }
.mk-notice.is-open { display: flex; }
.mk-notice button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 6px 14px; cursor: pointer; font: inherit; }

/* 18+ age gate: only active when the head script added .mk-age-gated (JS clients without the cookie).
   Bots and no-JS clients get the plain page - no cloaking, identical HTML, cache-safe. */
.mk-age { display: none; }
.mk-age-gated .mk-age { display: grid; position: fixed; inset: 0; z-index: 100; place-items: center; padding: 16px;
  background: var(--bg); /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.mk-age-gated body { overflow: hidden; }
.mk-age-box { max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; text-align: center; }
.mk-age-box h2 { margin: 0 0 8px; font-family: var(--font-serif); font-weight: 400; }
.mk-age-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.mk-age-actions button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; cursor: pointer; }
.mk-age-actions a { align-self: center; color: var(--muted); }
.mk-age-note { font-size: 13px; color: var(--muted); }
