/* Generated by tools/theme from Omarchy palettes. Edit tools/theme/base.css, then run make theme. */

:root {
  color-scheme: light;
  --bg: #FFFCF0;
  --bg-dark: #f2efe4;
  --bg-darker: #e5e2d8;
  --bg-lighter: #E6E4D9;
  --fg: #100F0F;
  --fg-dim: #878580;
  --fg-soft: #403E3C;
  --accent: #205EA6;
  --selection: #CECDC3;
  --muted: #B7B5AC;
  --red: #D14D41;
  --yellow: #D0A215;
  --orange: #d0772b;
  --green: #879A39;
  --cyan: #3AA99F;
  --blue: #205EA6;
  --magenta: #CE5D97;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #2e3440;
    --bg-dark: #222730;
    --bg-darker: #191c23;
    --bg-lighter: #3b4252;
    --fg: #d8dee9;
    --fg-dim: #667080;
    --fg-soft: #adb5c4;
    --accent: #81a1c1;
    --selection: #434c5e;
    --muted: #4c566a;
    --red: #bf616a;
    --yellow: #ebcb8b;
    --orange: #d5967a;
    --green: #a3be8c;
    --cyan: #88c0d0;
    --blue: #81a1c1;
    --magenta: #b48ead;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #2e3440;
  --bg-dark: #222730;
  --bg-darker: #191c23;
  --bg-lighter: #3b4252;
  --fg: #d8dee9;
  --fg-dim: #667080;
  --fg-soft: #adb5c4;
  --accent: #81a1c1;
  --selection: #434c5e;
  --muted: #4c566a;
  --red: #bf616a;
  --yellow: #ebcb8b;
  --orange: #d5967a;
  --green: #a3be8c;
  --cyan: #88c0d0;
  --blue: #81a1c1;
  --magenta: #b48ead;
}

/* ---- Fonts --------------------------------------------------------------
   EB Garamond and Cinzel (both SIL OFL) ship in book/fonts. Garamond is
   split by script so Greek (including polytonic) comes from Garamond, not
   the maths font. Berkeley Mono is licensed, kept out of git, and copied
   into book/fonts/berkeley-mono by `make fonts`; when it is absent the stack
   falls back to IBM Plex Mono, then Iosevka, if the reader has them. */

@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-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+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: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-400-italic.woff2") format("woff2"); 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: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-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+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: "EB Garamond"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-600-italic.woff2") format("woff2"); 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: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-ext-400-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "EB Garamond"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-latin-ext-600-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-400-normal.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-400-italic.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-600-normal.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-600-italic.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-ext-400-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-ext-400-italic.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-ext-600-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/eb-garamond/eb-garamond-greek-ext-600-italic.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/cinzel/cinzel-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cinzel/cinzel-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/berkeley-mono/BerkeleyMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/berkeley-mono/BerkeleyMono-Oblique.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/berkeley-mono/BerkeleyMono-Bold.woff2") format("woff2"); }
@font-face { font-family: "Berkeley Mono"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/berkeley-mono/BerkeleyMono-Bold-Oblique.woff2") format("woff2"); }

:root {
  --font-body: "EB Garamond", Garamond, Georgia, serif;
  --font-title: "Cinzel", "EB Garamond", Garamond, serif;
  --font-mono: "Berkeley Mono", "IBM Plex Mono", "Iosevka", ui-monospace, monospace;
  --title: #7c5216; /* parchment-amber, darkened for the light page */
  --section: #2f4f6f; /* deep grey-blue: the light accent is too saturated for headings */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --title: #e9d3a3; --section: var(--accent); } }
:root[data-theme="dark"] { --title: #e9d3a3; --section: var(--accent); } /* the cover's parchment */

/* ---- Frame --------------------------------------------------------------- */

html, body, .book, .book-body, .book .book-body, .book-body .body-inner {
  background: var(--bg);
  color: var(--fg);
  letter-spacing: normal; /* theme-default tracks everything by .2px, which breaks kerning */
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.book-body .page-wrapper .page-inner { max-width: 720px; } /* about 70 characters at 19.5px */

.book-body .page-wrapper .page-inner section.normal {
  font-family: var(--font-body);
  font-size: 19.5px;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  color: var(--fg);
}

::selection { background: var(--selection); color: var(--fg); }

/* ---- Header and toolbar ---------------------------------------------------- */

.book-header {
  font-family: var(--font-mono);
  color: var(--fg-dim);
  background: var(--bg);
  border-bottom: 1px solid var(--bg-darker);
}
.book-header h1 { font-family: var(--font-title); color: var(--title); letter-spacing: 0.06em; }
.book-header .btn { color: var(--fg-dim); }
.book-header .btn:hover { color: var(--accent); }

/* ---- Sidebar --------------------------------------------------------------- */

.book-summary {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--fg-soft);
  background: var(--bg-dark);
  border-right: 1px solid var(--bg-darker);
}
.book-summary ul.summary li a,
.book-summary ul.summary li span,
.book-summary ul.summary li.done > a { color: var(--fg-soft); }
.book-summary ul.summary li a:hover { color: var(--accent); text-decoration: none; }
.book-summary ul.summary li.active > a { color: var(--accent); font-weight: 700; }
.book-summary ul.summary li.header { font-family: var(--font-title); font-size: 1.2rem; color: var(--title); letter-spacing: 0.04em; }
.book-summary ul.summary li.divider { background: var(--bg-darker); }

#book-search-input { background: var(--bg-dark); border-color: var(--bg-darker); }
#book-search-input input, #book-search-input input:focus, #book-search-input input:hover {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--fg);
}
#book-search-results .search-results .has-results .search-results-item { color: var(--fg); }
#book-search-results .search-results .has-results .search-results-item a { color: var(--accent); }

/* ---- Prose ----------------------------------------------------------------- */

.markdown-section h1, .markdown-section h2, .markdown-section h3,
.markdown-section h4, .markdown-section h5, .markdown-section h6 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--fg);
}
.markdown-section h1 {
  font-family: var(--font-title);
  font-weight: 400;
  color: var(--title);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--muted);
  padding-bottom: 0.3em;
}
.markdown-section h2 { color: var(--section); }
.markdown-section h3 { font-size: 1.2em; font-style: italic; font-weight: 400; } /* let h2 lead */

.markdown-section a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 0.15em; }
.markdown-section a:hover { text-decoration-color: var(--accent); }

.markdown-section strong { font-weight: 600; }
.markdown-section hr { background: var(--muted); height: 1px; }

.markdown-section blockquote {
  color: var(--fg-soft);
  border-left: 3px solid var(--accent);
  background: var(--bg-dark);
  padding: 0.4em 1em;
}

.markdown-section table tr { background: var(--bg); border-top: 1px solid var(--muted); }
.markdown-section table tr:nth-child(2n) { background: var(--bg-dark); }
.markdown-section table th, .markdown-section table td { border: 1px solid var(--muted); }

.markdown-section details {
  background: var(--bg-dark);
  border-left: 3px solid var(--muted);
  padding: 0.4em 1em;
  margin-bottom: 1em;
}
.markdown-section details summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.8em; color: var(--fg-dim); }
.markdown-section details[open] summary { color: var(--accent); }

/* ---- Code ------------------------------------------------------------------ */

.markdown-section code, .markdown-section pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}
.markdown-section code {
  background: var(--bg-dark);
  color: var(--fg);
  border-radius: 2px;
}
.markdown-section pre {
  background: var(--bg-darker);
  border-left: 3px solid var(--accent);
  border-radius: 0;
}
.markdown-section pre > code { background: none; font-size: 0.78em; }

.hljs-comment, .hljs-quote { color: var(--fg-dim); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: var(--magenta); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--green); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--orange); }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: var(--blue); }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title { color: var(--cyan); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--yellow); }
.hljs-meta, .hljs-deletion { color: var(--red); }

/* ---- Figures (inlined SVG, coloured by currentColor) ------------------------ */

.aec-figure { display: block; margin: 1.2em auto; color: var(--fg); }
.aec-figure svg { display: block; width: 100%; height: auto; max-width: 640px; margin: 0 auto; }

/* ---- Math and navigation --------------------------------------------------- */

.katex { color: inherit; font-size: 1.04em; } /* KaTeX defaults to 1.21em; its Computer Modern runs large and heavy beside Garamond */

.navigation { color: var(--muted); }
.navigation:hover { color: var(--accent); }
