/* ============================================================
   Irodori theme for mdBook — unified with the Irodori Table app
   (light = "Irodori Paper", dark = "Irodori Evergreen"), including
   code highlighting. Loaded via book.toml `additional-css`.
   ============================================================ */

:root {
  /* Uniform density: shrink the whole UI by lowering mdBook's 62.5% root.
     Everything is rem-based, so the scale stays consistent. */
  font-size: 58%;
  --ir-teal: #157f85;
}

/* ---------- Typography ---------- */
html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.content { line-height: 1.5; overflow-wrap: break-word; }
.content main { max-width: 820px; }
.content p,
.content li { line-height: 1.55; }
.content p,
.content ul,
.content ol { margin: 0.55rem 0; }
.content h1,
.content h2,
.content h3,
.content h4 { font-weight: 650; letter-spacing: -0.012em; line-height: 1.25; }
.content h1 { font-size: 1.9rem; margin-top: 0.3rem; }
.content h2 {
  margin-top: 1.7rem;
  padding-bottom: 0.24rem;
  border-bottom: 1px solid var(--table-border-color);
}
.content h3 { margin-top: 1.15rem; }
.content a { text-decoration: none; overflow-wrap: anywhere; }
.content a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- No horizontal page scroll ---------- */
.content pre { overflow-x: auto; max-width: 100%; }
.content pre > code { white-space: pre; }
.content table {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.content img { max-width: 100%; height: auto; }

/* ---------- Top menu bar + logo ---------- */
.menu-title { font-weight: 650; letter-spacing: -0.01em; }
.menu-title .irodori-logo {
  height: 24px;
  width: 24px;
  vertical-align: -6px;
  margin-right: 0.7rem;
}

/* ---------- Blockquote callouts ---------- */
.content blockquote {
  border-inline-start: 3px solid var(--ir-teal);
  border-radius: 6px;
  padding: 0.45rem 1rem;
  margin: 0.9rem 0;
}
.content blockquote p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
.content table td,
.content table th { padding: 0.34rem 0.72rem; }
.content table thead th { color: #ffffff; }

/* ---------- Code ---------- */
.content code { overflow-wrap: anywhere; }
.content pre code { border-radius: 8px; }
.content pre > .buttons { opacity: 0.45; }

/* =====================================================================
   LIGHT  →  "Irodori Paper"  (matches the app's default light theme)
   ===================================================================== */
html.light {
  --bg: #faf9f3;
  --fg: #383d3a;
  --sidebar-bg: #f1eee3;
  --sidebar-fg: #5a5f5a;
  --sidebar-non-existant: #b6b0a2;
  --sidebar-active: #157f85;
  --sidebar-spacer: #e2ddd0;
  --scrollbar: #cfc8b6;
  --icons: #6c726c;
  --icons-hover: #157f85;
  --links: #157f85;
  --inline-code-color: #9a6a1e;
  --theme-popup-bg: #ffffff;
  --theme-popup-border: #e2ddd0;
  --theme-hover: #efece2;
  --quote-bg: #f3f0e6;
  --quote-border: #157f85;
  --table-border-color: #e2ddd0;
  --table-header-bg: #157f85;
  --table-alternate-bg: #f6f4ec;
  --searchbar-border-color: #cfc8b6;
  --searchbar-bg: #ffffff;
  --searchbar-fg: #383d3a;
  --searchbar-shadow-color: #cfc8b6;
  --searchresults-header-fg: #6c726c;
  --searchresults-border-color: #e2ddd0;
  --searchresults-li-bg: #f1eee3;
  --search-mark-bg: #e0c08a;
  --color-scheme: light;
}
html.light .menu-bar { border-bottom: 1px solid #e7e2d5; }
/* code tokens (Irodori Paper syntax) */
html.light .hljs-comment,
html.light .hljs-quote { color: #7d837a; font-style: italic; }
html.light .hljs-keyword,
html.light .hljs-selector-tag,
html.light .hljs-meta-keyword { color: #8a4f9e; }
html.light .hljs-string,
html.light .hljs-regexp,
html.light .hljs-meta .hljs-string { color: #4d8a4a; }
html.light .hljs-number,
html.light .hljs-symbol,
html.light .hljs-bullet { color: #9a6a1e; }
html.light .hljs-literal,
html.light .hljs-built_in.literal { color: #9a6a1e; }
html.light .hljs-type,
html.light .hljs-class .hljs-title,
html.light .hljs-built_in { color: #157f85; }
html.light .hljs-title,
html.light .hljs-section,
html.light .hljs-function .hljs-title { color: #b0563f; }
html.light .hljs-attr,
html.light .hljs-attribute,
html.light .hljs-property,
html.light .hljs-link { color: #3a6ea8; }
html.light .hljs-name,
html.light .hljs-tag { color: #8a4f9e; }
html.light .hljs-meta { color: #6c726c; }

/* =====================================================================
   NAVY  →  "Irodori Evergreen"  (matches the app's default dark theme)
   ===================================================================== */
html.navy {
  --bg: #1a201d;
  --fg: #d7d8c9;
  --sidebar-bg: #141916;
  --sidebar-fg: #aab2a8;
  --sidebar-non-existant: #5a635d;
  --sidebar-active: #78b5ac;
  --sidebar-spacer: #2a322d;
  --scrollbar: #3a443d;
  --icons: #8b938a;
  --icons-hover: #78b5ac;
  --links: #87b4cc;
  --inline-code-color: #e0c08a;
  --theme-popup-bg: #1e2522;
  --theme-popup-border: #2a322d;
  --theme-hover: #232b27;
  --quote-bg: #1e2522;
  --quote-border: #78b5ac;
  --table-border-color: #2a322d;
  --table-header-bg: #1e3b38;
  --table-alternate-bg: #1d2420;
  --searchbar-border-color: #3a443d;
  --searchbar-bg: #1e2522;
  --searchbar-fg: #d7d8c9;
  --searchbar-shadow-color: #0e120f;
  --searchresults-header-fg: #8b938a;
  --searchresults-border-color: #2a322d;
  --searchresults-li-bg: #1e2522;
  --search-mark-bg: #e0c08a;
  --color-scheme: dark;
}
html.navy .menu-bar { border-bottom: 1px solid #2a322d; }
html.navy .content table thead th { color: #eafcfb; }
/* code tokens (Irodori Evergreen syntax) */
html.navy .hljs-comment,
html.navy .hljs-quote { color: #79847b; font-style: italic; }
html.navy .hljs-keyword,
html.navy .hljs-selector-tag,
html.navy .hljs-meta-keyword { color: #9d8bbf; }
html.navy .hljs-string,
html.navy .hljs-regexp,
html.navy .hljs-meta .hljs-string { color: #8fb573; }
html.navy .hljs-number,
html.navy .hljs-symbol,
html.navy .hljs-bullet { color: #d989a0; }
html.navy .hljs-literal { color: #e09a66; }
html.navy .hljs-type,
html.navy .hljs-class .hljs-title,
html.navy .hljs-built_in { color: #78b5ac; }
html.navy .hljs-title,
html.navy .hljs-section,
html.navy .hljs-function .hljs-title { color: #7e9cd8; }
html.navy .hljs-attr,
html.navy .hljs-attribute,
html.navy .hljs-property,
html.navy .hljs-link { color: #87b4cc; }
html.navy .hljs-name,
html.navy .hljs-tag { color: #9d8bbf; }
html.navy .hljs-meta { color: #8b938a; }
