/* Metis design tokens. Source of truth: docs/design-brief.md ("Orbit").
   Paper and ink, one green accent, gold used sparingly, no blue in the shell.
   Light is the default; dark follows the system unless data-theme pins it. */

/* ---------- Fonts (bundled, OFL) ---------- */
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

@font-face { font-family: "Noto Naskh Arabic"; font-weight: 400; font-display: swap; src: url("fonts/noto-naskh-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 500; font-display: swap; src: url("fonts/noto-naskh-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 600; font-display: swap; src: url("fonts/noto-naskh-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 700; font-display: swap; src: url("fonts/noto-naskh-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 400; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 500; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 600; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 700; font-display: swap; src: url("fonts/noto-naskh-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* Display: Readex Pro, one geometric family for Arabic and Latin (the brand's Godber is not licensed for the web). Variable weight. */
@font-face { font-family: "Readex Pro"; font-weight: 160 700; font-display: swap; src: url("fonts/readex-pro-latin-wght-normal.woff2") format("woff2-variations"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 160 700; font-display: swap; src: url("fonts/readex-pro-arabic-wght-normal.woff2") format("woff2-variations"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Surfaces: the frame holds the sheet; the sheet holds the work. */
  --frame: #efe9db;
  --sheet: #fbf8f1;
  --raised: #fffdf8;
  --sunken: #f3eee2;
  --line: #e7e0d0;
  --line-strong: #dcd3c0;

  /* Ink */
  --ink: #414042;
  --ink-2: #5c5b5e;
  --ink-3: #676669;

  /* Accent: Metis Note emerald (#2BB673), deepened to pass AA as text. One accent only. */
  --accent: #16774a;
  --accent-strong: #11663f;
  --accent-soft: #e0f2e8;
  --on-accent: #fffdf8;

  /* Gold, used sparingly: current item, today, the focus node. Nothing else. */
  --gold: #8a5a12;
  --gold-fill: #efc88b;
  --gold-soft: #f6ead2;

  /* Status. Always shown with an icon or label, never colour alone. */
  --good: #2f6f4f;
  --good-soft: #e1eee5;
  --warn: #8a5a12;
  --warn-soft: #f6ead2;
  --danger: #b3362f;
  --danger-soft: #f6dfdb;
  --info: #4c5f78;
  --info-soft: #e4e9ef;

  /* Night: used for dark bands on a light page. */
  --night: #2b2a2c;
  --night-raised: #333234;
  --night-line: #454447;
  --night-ink: #ece7dc;
  --night-ink-2: #c4c0b8;
  --night-accent: #34c07d;

  /* Type */
  --font-ui: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Noto Naskh Arabic", "Iowan Old Style", Georgia, serif;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  /* Radius: 6 controls, 10 cards, 14 sheets. */
  --r-control: 6px;
  --r-card: 10px;
  --r-sheet: 14px;
  --r-pill: 999px;

  /* One soft shadow for sheets, one for things that float above them. */
  --shadow-sheet: 0 1px 2px rgba(60, 48, 24, 0.05), 0 12px 32px -12px rgba(60, 48, 24, 0.16);
  --shadow-float: 0 2px 6px rgba(60, 48, 24, 0.08), 0 24px 60px -18px rgba(60, 48, 24, 0.28);

  /* Space scale (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;

  /* Motion: 160ms ease-out for the interface. Scroll scenes are set in JS. */
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
  --fast: 160ms;
  --slow: 420ms;
}

/* Dark values, written once and applied by either rule below. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --frame: #2b2a2c; --sheet: #333234; --raised: #3c3b3d; --sunken: #2f2e30;
    --line: #403f42; --line-strong: #4b4a4d;
    --ink: #ece7dc; --ink-2: #c4c0b8; --ink-3: #a9a6a0;
    --accent: #34c07d; --accent-strong: #5fd29a; --accent-soft: #2c4a3a; --on-accent: #2b2a2c;
    --gold: #e0ad5a; --gold-fill: #efc88b; --gold-soft: #3a3020;
    --good: #8fc7a6; --good-soft: #20322a; --warn: #e0ad5a; --warn-soft: #3a3020;
    --danger: #ec7a72; --danger-soft: #3d2423; --info: #9db2cf; --info-soft: #232b38;
    --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -14px rgba(0, 0, 0, 0.6);
    --shadow-float: 0 2px 6px rgba(0, 0, 0, 0.35), 0 28px 70px -20px rgba(0, 0, 0, 0.75);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --frame: #2b2a2c; --sheet: #333234; --raised: #3c3b3d; --sunken: #2f2e30;
  --line: #403f42; --line-strong: #4b4a4d;
  --ink: #ece7dc; --ink-2: #c4c0b8; --ink-3: #a9a6a0;
  --accent: #34c07d; --accent-strong: #5fd29a; --accent-soft: #2c4a3a; --on-accent: #2b2a2c;
  --gold: #e0ad5a; --gold-fill: #efc88b; --gold-soft: #3a3020;
  --good: #8fc7a6; --good-soft: #20322a; --warn: #e0ad5a; --warn-soft: #3a3020;
  --danger: #ec7a72; --danger-soft: #3d2423; --info: #9db2cf; --info-soft: #232b38;
  --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -14px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 2px 6px rgba(0, 0, 0, 0.35), 0 28px 70px -20px rgba(0, 0, 0, 0.75);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--frame);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-fill); color: #414042; }
[hidden] { display: none !important; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }
/* Arrows and chevrons point the other way in right-to-left. */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
