/* Loma Sub theme for HonKit — palette and fonts from https://lomasub.ai/ */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&family=Noto+Serif+Thai:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  --ocean-600: #0a7e8c;
  --ocean-500: #0d9ba8;
  --ocean-400: #2ec4d4;
  --ocean-300: #7ddce8;
  --ocean-100: #d4f4f8;
  --coral-500: #e8655a;
  --coral-400: #f0897f;
  --coral-200: #fadbd8;
  --coral-100: #fdf0ef;
  --ink-900: #1a1d21;
  --ink-700: #3d4248;
  --ink-500: #6b7280;
  --ink-300: #b0b6bf;
  --ink-100: #e8eaed;
  --success: #2d9f6f;
  --surface-ghost: #fafbfc;
  --font-body: "Noto Sans Thai", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Noto Serif Thai", Georgia, "Times New Roman", serif;
  --font-display: "IBM Plex Sans Thai", "Noto Sans Thai", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ---------- Base typography ---------- */

.book,
.book-summary,
.book-body,
.markdown-section {
  font-family: var(--font-body);
  color: var(--ink-900);
}

.markdown-section {
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--ink-700);
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.markdown-section h1 {
  font-size: 2em;
}

.markdown-section h2 {
  border-bottom: 1px solid var(--ink-100);
  padding-bottom: 0.35em;
}

.markdown-section strong {
  color: var(--ink-900);
}

.markdown-section hr {
  border: none;
  border-top: 1px solid var(--ink-100);
}

/* ---------- Links ---------- */

.markdown-section a {
  color: var(--ocean-600);
  text-decoration: none;
  border-bottom: 1px solid var(--ocean-300);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.markdown-section a:hover {
  color: var(--ocean-500);
  border-bottom-color: var(--ocean-500);
}

/* ---------- Body background ---------- */

.book-body,
.body-inner {
  background: var(--surface-ghost);
}

.page-inner {
  max-width: 860px;
}

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

.book-summary {
  background: #ffffff;
  border-right: 1px solid var(--ink-100);
  font-family: var(--font-body);
}

.book-summary ul.summary li a,
.book-summary ul.summary li span {
  color: var(--ink-700);
  font-size: 15px;
  padding: 8px 15px;
  border-radius: 9999px;
  margin: 2px 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.book-summary ul.summary li a:hover {
  background: var(--surface-ghost);
  color: var(--ink-900);
  text-decoration: none;
}

.book-summary ul.summary li.active > a {
  background: var(--ocean-100);
  color: var(--ocean-600);
  font-weight: 600;
  box-shadow: none;
  border: none;
}

.book-summary ul.summary li.header {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
  padding: 14px 15px 4px;
  margin: 6px 8px 0;
}

.book-summary ul.summary li.divider {
  background: var(--ink-100);
  margin: 7px 16px;
}

/* ---------- Top header bar (GitBook-style) ---------- */

.loma-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-100);
  font-family: var(--font-display);
}

.loma-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.loma-topbar-brand img {
  height: 28px;
  width: auto;
}

.loma-topbar-brand span {
  font-size: 21px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  font-weight: 400;
}

.loma-topbar-brand span strong {
  font-weight: 600;
}

.loma-topbar-search {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* search pill relocated into the topbar */
.loma-topbar-search #book-search-input {
  display: flex;
  align-items: center;
  width: min(380px, 42vw);
  margin: 0;
  padding: 0 16px;
  height: 40px;
  background: #ffffff;
  border: 1px solid var(--ink-100);
  border-radius: 9999px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.loma-topbar-search #book-search-input::before {
  content: "\f002";
  font-family: FontAwesome;
  font-size: 14px;
  color: var(--ink-300);
  margin-right: 10px;
}

.loma-topbar-search #book-search-input:focus-within {
  border-color: var(--ocean-400);
  box-shadow: 0 0 0 3px var(--ocean-100);
}

.loma-topbar-search #book-search-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-900);
  padding: 0;
}

.loma-topbar-search #book-search-input input::placeholder {
  color: var(--ink-300);
}

/* sidebar toggle — mobile only */
.loma-topbar-toggle {
  display: none;
  border: none;
  background: none;
  font-size: 18px;
  color: var(--ink-700);
  padding: 8px;
  cursor: pointer;
}

/* push book layout below the fixed topbar */
.book-summary,
.book-body {
  top: 64px;
}

/* hide the old in-content toolbar (duplicated page title) */
.book-header {
  display: none;
}

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

.markdown-section code,
.markdown-section pre {
  font-family: var(--font-mono);
  border-radius: 10px;
}

.markdown-section code {
  background: var(--ocean-100);
  color: var(--ocean-600);
  padding: 0.15em 0.45em;
  font-size: 0.85em;
}

.markdown-section pre {
  background: var(--ink-900);
  padding: 18px 20px;
  border-radius: 14px;
}

.markdown-section pre > code {
  background: transparent;
  color: var(--ink-100);
  font-size: 0.86em;
  line-height: 1.65;
}

/* syntax highlight tweaks on dark blocks */
.markdown-section pre .hljs-string,
.markdown-section pre .hljs-attr {
  color: var(--ocean-300);
}

.markdown-section pre .hljs-number,
.markdown-section pre .hljs-literal {
  color: var(--coral-400);
}

.markdown-section pre .hljs-keyword,
.markdown-section pre .hljs-built_in {
  color: var(--ocean-400);
}

.markdown-section pre .hljs-comment {
  color: var(--ink-300);
}

/* ---------- Tables ---------- */

.markdown-section table {
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  display: table;
  width: 100%;
}

.markdown-section table th {
  background: var(--surface-ghost);
  color: var(--ink-900);
  font-family: var(--font-display);
  font-weight: 600;
  border: none;
  border-bottom: 2px solid var(--ocean-100);
  padding: 10px 14px;
}

.markdown-section table td {
  border: none;
  border-bottom: 1px solid var(--ink-100);
  padding: 9px 14px;
  color: var(--ink-700);
}

.markdown-section table tr:last-child td {
  border-bottom: none;
}

.markdown-section table tr:nth-child(2n) {
  background: var(--surface-ghost);
}

/* ---------- Blockquotes (notes) ---------- */

.markdown-section blockquote {
  border-left: 4px solid var(--ocean-400);
  background: var(--ocean-100);
  border-radius: 0 12px 12px 0;
  padding: 12px 18px;
  color: var(--ink-700);
  margin: 1.2em 0;
}

.markdown-section blockquote p {
  margin: 0;
}

/* ---------- Overview page extras ---------- */

.loma-tagline {
  font-family: var(--font-display);
  font-size: 1.15em;
  color: var(--ocean-600);
  font-weight: 500;
}

.loma-stats table {
  border: 1px solid var(--ocean-100);
  box-shadow: 0 6px 24px rgba(13, 155, 168, 0.08);
}

.loma-stats table th {
  font-size: 1.5em;
  color: var(--ocean-600);
  background: #ffffff;
  border-bottom: none;
  padding-top: 18px;
}

.loma-stats table td {
  color: var(--ink-500);
  text-align: center;
  padding-bottom: 18px;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  .markdown-section {
    font-size: 15px;
  }

  .loma-topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .loma-topbar-toggle {
    display: inline-flex;
  }

  .loma-topbar-brand span {
    font-size: 18px;
  }

  .loma-topbar-search #book-search-input {
    width: min(220px, 48vw);
  }
}
