/* Design tokens. Components use these roles, never raw values.
   Palette: blue-black ink on cool paper, with a highlighter for the passage you tapped. */

@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-greek-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 200 900; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  /* colour roles */
  --bg: #eef1ec;            /* cool paper */
  --surface: #ffffff;       /* a sheet laid on the desk */
  --surface-2: #f6f8f4;     /* quiet fills */
  --ink: #1b2431;           /* blue-black ink */
  --ink-muted: #4f5a69;
  --ink-faint: #5c6674;
  --rule: #d3d9d0;
  --rule-strong: #78828f;   /* input borders and dot outlines, 3:1 on paper */
  --accent: #1f4b8a;        /* fountain-pen blue */
  --accent-ink: #ffffff;
  --accent-soft: #e3ebf7;
  --highlight: #f3e35a;     /* highlighter */
  --highlight-ink: #1b2431;
  --pencil: #6d6455;        /* margin marks */
  --rubric: #9b2c24;        /* the gloss's own mark, as glosses were written in red */
  --success: #23633f;
  --success-soft: #e2f0e7;
  --warning: #8a5a00;
  --warning-soft: #fbf0d6;
  --danger: #a13226;
  --danger-soft: #f8e4e1;
  --scrim: rgb(17 22 30 / 0.45);
  /* the camera: dark in either theme, as a camera's screen is */
  --camera-bg: #000000;
  --camera-ink: #ffffff;
  --camera-scrim: rgb(0 0 0 / 0.55);
  --camera-line: rgb(255 255 255 / 0.6);
  --camera-ready: #f3e35a;  /* the highlighter: steady enough */

  /* book spines, muted cloth colours */
  --spine-1: #1f4b8a; --spine-2: #7b2e2e; --spine-3: #2e5e46; --spine-4: #8a6a1f;
  --spine-5: #4b4f73; --spine-6: #6a3b5f; --spine-7: #2f6670;
  --cover-ink: #ffffff;     /* the letter stamped on a cover */
  --apple-bg: #000000;      /* Sign in with Apple: black on a light page, white on a dark one */
  --apple-ink: #ffffff;
  /* each book's plant (garden.js): its ink line, how strongly its washes are laid on the paper,
     and the strips of paper holding a pressed one down */
  --plant-ink: #1b2431;
  --plant-wash: 1;
  --plant-strap: #f3efe4;
  --plant-strap-line: #b9b1a0;

  /* type */
  --font-book: "Literata", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: 0.8125rem;   /* 13 */
  --fs-sm: 0.9375rem;   /* 15 */
  --fs-md: 1.0625rem;   /* 17 */
  --fs-lg: 1.25rem;     /* 20 */
  --fs-xl: 1.625rem;    /* 26 */
  --fs-2xl: 2.125rem;   /* 34 */
  --lh-ui: 1.4;
  --lh-book: 1.68;

  /* space, 4px base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  /* shape and depth */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --paper-shadow: 0 1px 0 rgb(27 36 49 / 0.06), 0 10px 30px -12px rgb(27 36 49 / 0.28);
  /* a page with another leaf under it, showing at its right and bottom edges */
  --leaves: 0 0 0 1px var(--rule), 7px 9px 0 -1px var(--surface-2), 7px 9px 0 0 var(--rule);
  --sheet-shadow: 0 -12px 40px -16px rgb(27 36 49 / 0.35);

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 140ms;
  --t-med: 260ms;

  /* layout */
  --content: 600px;
  --nav-h: 64px;
  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11151b;
    --surface: #1a2029;
    --surface-2: #151a22;
    --ink: #e5e9ef;
    --ink-muted: #a7b1bf;
    --ink-faint: #8a95a4;
    --rule: #2b333e;
    --rule-strong: #6a7584;
    --accent: #9bbcf2;
    --accent-ink: #0f1722;
    --accent-soft: #1e2b40;
    --highlight: #6b6220;
    --highlight-ink: #fdf8d4;
    --pencil: #b7ab95;
    --rubric: #f0998e;
    --success: #7fcf9f;
    --success-soft: #16291f;
    --warning: #f0c36a;
    --warning-soft: #2b2312;
    --danger: #f0998e;
    --danger-soft: #331b18;
    --scrim: rgb(0 0 0 / 0.6);

    --spine-1: #6f97d6; --spine-2: #c27a72; --spine-3: #78b394; --spine-4: #cfae62;
    --spine-5: #9aa0cf; --spine-6: #c08bb5; --spine-7: #72b6bf;
    --cover-ink: #11151b;
    --apple-bg: #ffffff;
    --apple-ink: #000000;
    --plant-ink: #d3dacf;
    --plant-wash: 0.6;
    --plant-strap: #2c333c;
    --plant-strap-line: #5f6976;
    --paper-shadow: 0 1px 0 rgb(0 0 0 / 0.4), 0 12px 32px -14px rgb(0 0 0 / 0.7);
    --sheet-shadow: 0 -12px 40px -16px rgb(0 0 0 / 0.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151b;
  --surface: #1a2029;
  --surface-2: #151a22;
  --ink: #e5e9ef;
  --ink-muted: #a7b1bf;
  --ink-faint: #8a95a4;
  --rule: #2b333e;
  --rule-strong: #6a7584;
  --accent: #9bbcf2;
  --accent-ink: #0f1722;
  --accent-soft: #1e2b40;
  --highlight: #6b6220;
  --highlight-ink: #fdf8d4;
  --pencil: #b7ab95;
  --rubric: #f0998e;
  --success: #7fcf9f;
  --success-soft: #16291f;
  --warning: #f0c36a;
  --warning-soft: #2b2312;
  --danger: #f0998e;
  --danger-soft: #331b18;
  --scrim: rgb(0 0 0 / 0.6);

  --spine-1: #6f97d6; --spine-2: #c27a72; --spine-3: #78b394; --spine-4: #cfae62;
  --spine-5: #9aa0cf; --spine-6: #c08bb5; --spine-7: #72b6bf;
  --cover-ink: #11151b;
  --apple-bg: #ffffff;
  --apple-ink: #000000;
  --plant-ink: #d3dacf;
  --plant-wash: 0.6;
  --plant-strap: #2c333c;
  --plant-strap-line: #5f6976;
  --paper-shadow: 0 1px 0 rgb(0 0 0 / 0.4), 0 12px 32px -14px rgb(0 0 0 / 0.7);
  --sheet-shadow: 0 -12px 40px -16px rgb(0 0 0 / 0.8);
}

/* Traditional Chinese, in the interface or in a book: Taiwan's fonts, which set ，。、 in the
   middle of the square rather than in its corner as mainland fonts do. The variables follow
   the language of each part of the page; an element tagged with it that has no font of its
   own (an explanation in Traditional Chinese under an English interface) takes the UI font. */
:lang(zh-Hant), :lang(zh-TW), :lang(zh-HK), :lang(zh-MO) {
  --font-book: "Literata", "Noto Serif TC", "Songti TC", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:where([lang|="zh-Hant"], [lang="zh-TW"], [lang="zh-HK"], [lang="zh-MO"]) { font-family: var(--font-ui); }

/* Japanese and Korean: their own fonts, which draw the characters they share with Chinese as
   readers there know them (and Korean's Hangul), the same way. */
:lang(ja) {
  --font-book: "Literata", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:lang(ko) {
  --font-book: "Literata", "AppleMyungjo", "Noto Serif KR", "Batang", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:where([lang|="ja"], [lang|="ko"]) { font-family: var(--font-ui); }
/* (Korean breaks a line between words, as it's written, not inside one; Japanese headings
   between phrases where the browser can tell them, つまずいたページは、/ 撮影するだけ。) */
:lang(ko) { word-break: keep-all; }
:lang(ja) :is(h1, h2, .lede) { word-break: auto-phrase; }
