/* Khejri workbench: grey-green archival paper, white answer sheets, charcoal ink.
   Olive marks your documents, plum marks web search, saffron marks the answer you preferred. Nothing else gets colour.
   No drop shadows: hierarchy comes from surface tone (canvas < sheet) and two border tiers (--rule decorative, --rule-ui interactive).
   One light theme. Every text pair passes WCAG AA; --rule-ui and --focus pass 3:1. */
@font-face { font-family: "Zodiak"; src: url("/fonts/zodiak-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Zodiak"; src: url("/fonts/zodiak-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("/fonts/general-sans.woff2") format("woff2"); font-weight: 200 700; font-display: swap; }

:root {
  color-scheme: light;
  --canvas: #f4f3ec;       /* page, masthead, composer tray */
  --rail: #e7e6da;         /* documents rail */
  --sheet: #ffffff;        /* answers, composer, colophon */
  --recessed: #efeee5;     /* the answer you did not prefer (full-opacity text) */
  --ink: #1b1d15;
  --ink-2: #4a4d3e;
  --ink-meta: #606352;     /* sizes, timings, URLs: 4.91:1 on the rail */
  --rule: #d5d4c6;         /* decorative dividers */
  --rule-ui: #77796a;      /* inputs, buttons, rail edge: 3:1+ */
  --crown: #4f5d1e;        /* 3px top edge */
  --doc-accent: #4f5d1e;   /* khejri olive = your documents */
  --doc-tint: #f4f6ec;
  --web-accent: #6b2a5f;   /* plum = web search */
  --web-tint: #f8f1f6;
  --focus: #6b2a5f;
  --saffron-dot: #f7941d;  /* preferred stamp only */
  --saffron-bg: #fdf1dc;
  --saffron-ink: #854507;
  --saffron-border: #e0a958;
  --good: #1f5c3a;
  --bad: #9f2b1c;

  --radius: 2px;
  --masthead-h: 55px;      /* 52px + 3px crown */
  --font-display: "Zodiak", Georgia, "Times New Roman", serif;
  --font-body: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", "JetBrains Mono", monospace;
}

/* ─── Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); scrollbar-width: thin; scrollbar-color: var(--rule-ui) transparent; }
body { -webkit-user-select: text; user-select: text; margin: 0; background: var(--canvas); color: var(--ink); font: 400 0.95rem/1.6 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }
code, pre, kbd { font-family: var(--font-code); }
::selection { background: var(--doc-tint); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--rule-ui);
  background: var(--sheet); color: var(--ink); font: 600 0.86rem var(--font-body);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 110ms ease, border-color 110ms ease, color 110ms ease;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--doc-accent); border-color: var(--doc-accent); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); border-color: var(--rule-ui); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink); border-color: var(--ink); }
.link { font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--doc-accent); text-decoration-thickness: 1.5px; text-underline-offset: 0.25em; }
.link:hover { color: var(--doc-accent); }

/* ─── Masthead: paper band under a 3px olive crown ─────────────── */
.masthead { position: sticky; top: 0; z-index: 20; height: var(--masthead-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 22px; background: var(--canvas); border-top: 3px solid var(--crown); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; min-width: 0; }
.brand img { width: 26px; height: 29px; }
.brand b { font: 700 1.02rem var(--font-display); }
.brand .sl { color: var(--rule-ui); font-style: normal; }
.brand span { font-weight: 500; color: var(--ink-2); }
.mnav { display: flex; gap: 26px; align-self: stretch; }
.mnav a { display: flex; align-items: center; color: var(--ink-2); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mnav a:hover { color: var(--ink); }
.mnav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.mact { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 720px) {
  .masthead { grid-template-columns: 1fr auto; padding: 0 16px; }
  .brand .sl, .brand span, .mnav { display: none; }
}

/* ─── Answer prose ─────────────────────────────────────────────── */
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol { margin: 0.6em 0; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin: 0.2em 0; }
.prose a { color: var(--doc-accent); font-weight: 500; text-underline-offset: 2px; }
.prose h1, .prose h2, .prose h3, .prose h4 { font: 600 1.05rem var(--font-display); margin: 1em 0 0.4em; }
.prose table { border-collapse: collapse; margin: 0.5em 0 0.8em; display: block; overflow-x: auto; font-size: 0.92em; font-variant-numeric: tabular-nums; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 6px 14px 6px 0; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; color: var(--ink-2); border-bottom-color: var(--rule-ui); }
.prose code { font-size: 0.86em; padding: 0.1em 0.35em; border-radius: var(--radius); background: var(--rail); }
.prose .cite { color: var(--doc-accent); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
