:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #efe8da;
  --text: #2a2620;
  --muted: #6e6556;
  --border: #ddd3c0;
  --accent: #8a3b12;
  --accent-soft: #f3e0d2;
  --mark: #f5d77a;
  --ok: #3d6b3a;
  --warn: #8a5a00;
  --recon: #5a4a8a;
  --shadow: 0 1px 2px rgb(60 40 20 / 0.06), 0 2px 8px rgb(60 40 20 / 0.05);
  --radius: 10px;
  --font-ui: 'Noto Serif', Georgia, serif;
  --font-medieval: 'Junicode', 'Noto Serif', Georgia, serif;
  --font-runic: 'Noto Sans Runic', 'Segoe UI Historic', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1b1916;
    --surface: #24211d;
    --surface-2: #2e2a24;
    --text: #ece6da;
    --muted: #a99f8d;
    --border: #3d372f;
    --accent: #e39a6b;
    --accent-soft: #3a2a20;
    --mark: #7a6420;
    --ok: #8fc48a;
    --warn: #e2b45a;
    --recon: #b3a5e6;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #1b1916;
  --surface: #24211d;
  --surface-2: #2e2a24;
  --text: #ece6da;
  --muted: #a99f8d;
  --border: #3d372f;
  --accent: #e39a6b;
  --accent-soft: #3a2a20;
  --mark: #7a6420;
  --ok: #8fc48a;
  --warn: #e2b45a;
  --recon: #b3a5e6;
  --shadow: none;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; font-weight: 700; margin: 0 0 0.4em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.8em; }

code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0 0.3em; border-radius: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.muted { color: var(--muted); }
.medieval { font-family: var(--font-medieval); }
.runic { font-family: var(--font-runic); }

.icon { width: 1.2em; height: 1.2em; fill: currentColor; vertical-align: -0.2em; }

button, input, select { font: inherit; color: inherit; }

.btn, .chip, .icon-btn {
  display: inline-flex; align-items: center; gap: 0.35em;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; cursor: pointer; text-decoration: none;
}
.btn { padding: 0.4em 1em; }
.chip { padding: 0.2em 0.8em; font-size: 0.9rem; }
.icon-btn { padding: 0.35em; border-radius: 50%; line-height: 0; justify-content: center; flex-shrink: 0; min-width: 2.2rem; min-height: 2.2rem; }
/* Pekskärmar: tryckytor på minst 44 px, och formulärfält med minst 16 px text (annars zoomar iOS in). */
@media (pointer: coarse) {
  .icon-btn { min-width: 2.75rem; min-height: 2.75rem; }
  .btn { min-height: 2.75rem; }
  .chip { min-height: 2.25rem; }
  input, select, textarea { font-size: max(16px, 1em); }
}
.btn:hover, .chip:hover, .icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn[aria-disabled='true'], .icon-btn:disabled { opacity: 0.35; pointer-events: none; }
.icon-btn.active { background: var(--accent); color: var(--surface); border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.badge {
  display: inline-block; font-size: 0.75rem; padding: 0.1em 0.6em; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge-källa { color: var(--ok); }
.badge-ai-utkast { color: var(--warn); }
.badge-granskad { color: var(--ok); }
.badge-rekonstruktion, .badge-recon { color: var(--recon); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: 0.5em 1em; }
