/* Shares its theme with တရားနာယူ (D:\Dhamma_MP3), so the two sites look like one family. */
@font-face {
  font-family: "Noto Sans Myanmar Web"; font-weight: 400; font-display: swap;
  src: url("fonts/NotoSansMyanmar-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans Myanmar Web"; font-weight: 700; font-display: swap;
  src: url("fonts/NotoSansMyanmar-Bold.woff2") format("woff2");
}

:root {
  --bg: #f6f0e6; --surface: #fffaf2; --surface2: #efe5d5; --line: #e4d6c1;
  --text: #3b2f22; --muted: #7a6a58; --accent: #a0522d; --accent-hover: #8b4513;
  --on-accent: #fff; --saffron: #d9892b; --shadow: 0 4px 18px rgba(80, 50, 20, .10);
  --maxw: 720px; --read-size: 18px; --topbar-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16120e; --surface: #211b15; --surface2: #2d251d; --line: #3a3027;
    --text: #efe5d5; --muted: #b3a28d; --accent: #e0904a; --accent-hover: #f0a660;
    --on-accent: #1a120a; --saffron: #e8a24a; --shadow: 0 4px 18px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16120e; --surface: #211b15; --surface2: #2d251d; --line: #3a3027;
  --text: #efe5d5; --muted: #b3a28d; --accent: #e0904a; --accent-hover: #f0a660;
  --on-accent: #1a120a; --saffron: #e8a24a; --shadow: 0 4px 18px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Pyidaungsu", "Noto Sans Myanmar Web", system-ui, sans-serif;
  font-size: 16px; line-height: 1.9;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 2px;
  min-height: var(--topbar-h);
  /* the bar's contents share the text column's edges, at any screen width */
  padding: calc(6px + env(safe-area-inset-top)) max(8px, calc((100% - var(--maxw)) / 2 + 8px)) 6px max(16px, calc((100% - var(--maxw)) / 2 + 16px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 700; margin: 0; line-height: 2.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; flex: none; }
.icon-btn {
  flex: none; min-width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text);
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface2); } }  /* a tap must not leave it lit */
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.icon-btn.text { font-family: system-ui, sans-serif; font-size: 1rem; font-weight: 600; }
.icon-btn.back { font-size: 2rem; line-height: 1; margin-left: -10px; padding-bottom: 6px; }
#themeBtn .sun { display: none; }
#themeBtn.is-dark .sun { display: block; }
#themeBtn.is-dark .moon { display: none; }

main { max-width: var(--maxw); margin: 0 auto; padding: 12px 16px 36px; }
.loading { color: var(--muted); text-align: center; margin-top: 30vh; }
.section-title { font-size: 1rem; font-weight: 700; margin: 18px 0 8px; }
.card {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: hidden;
}
.empty { color: var(--muted); padding: 18px 14px; text-align: center; }

/* search */
.search { display: flex; gap: 8px; margin: 6px 0 4px; }
.search input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.search .btn { flex: none; padding: 6px 18px; border: 0; cursor: pointer; }
.status { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.snippet { display: block; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, var(--saffron) 45%, transparent); color: inherit; border-radius: 3px; }
mark.current { background: var(--saffron); color: #1a120a; }
.hit-block { background: color-mix(in srgb, var(--saffron) 18%, transparent); border-radius: 6px; }
.btn.more { display: block; margin: 14px auto 0; border: 0; cursor: pointer; }
.btn.more[hidden] { display: none; }
.hit-nav {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9;
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); font-size: .9rem;
}
.hit-nav .btn { padding: 4px 16px; border: 0; cursor: pointer; }

/* about */
.credit { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 22px; }
.about-hero { text-align: center; margin: 8px 0 18px; }
.about-hero img { border-radius: 20px; box-shadow: var(--shadow); }
.about-hero h2 { margin: 8px 0 0; font-size: 1.3rem; font-weight: 700; }
.about-hero p { margin: 2px 0 0; }
.about-card { padding: 14px 16px; margin-bottom: 14px; }
.about-card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 700; }
.about-card p { margin: 6px 0; }
.about-card ul { margin: 4px 0; padding-left: 20px; }
.about-card li { margin: 4px 0; }

/* home */
.cats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.cat { display: block; padding: 14px 16px; color: var(--text); text-decoration: none; }
.cat:hover { background: var(--surface2); }
.cat strong { display: block; font-size: 1.08rem; font-weight: 700; overflow-wrap: anywhere; }
.cat span { display: block; font-size: .85rem; color: var(--muted); }

/* lists */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list > li { border-bottom: 1px solid var(--line); }
ul.list > li:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; }
.row-main { flex: 1; min-width: 0; display: block; padding: 10px 14px; color: var(--text); text-decoration: none; }
.row-main:hover { background: var(--surface2); }
.row-title { display: block; overflow-wrap: anywhere; }
.row-meta { display: block; font-size: .8rem; color: var(--muted); }
.toggle { margin-right: 4px; color: var(--muted); font-size: 1rem; transition: transform .15s; }
.toggle[aria-expanded="true"] { transform: rotate(180deg); }
ul.sub { list-style: none; margin: 0; padding: 0 0 6px; background: color-mix(in srgb, var(--surface2) 40%, transparent); }
ul.sub a { display: block; padding: 7px 14px 7px 28px; color: var(--text); text-decoration: none; font-size: .94rem; overflow-wrap: anywhere; }
ul.sub a:hover { background: var(--surface2); }

/* book page */
.book-head { padding: 16px; }
.book-head h2 { font-size: 1.3rem; font-weight: 700; margin: 0; line-height: 1.8; overflow-wrap: anywhere; }
.book-head p { margin: 2px 0 12px; font-size: .88rem; color: var(--muted); }
.btn {
  display: inline-block; padding: 8px 26px; border-radius: 999px; font-weight: 700;
  background: var(--accent); color: var(--on-accent); text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }
.notice {
  margin: 12px 0 0; padding: 10px 14px; font-size: .88rem; line-height: 1.85;
  background: color-mix(in srgb, var(--saffron) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--saffron) 35%, var(--line)); border-radius: 12px;
}

/* reading page */
.reader { font-size: var(--read-size); line-height: 2.05; overflow-wrap: anywhere; }
.reader p { margin: 0 0 .85em; }
.reader h2, .reader h3 { font-weight: 700; line-height: 1.85; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.reader h2 { font-size: 1.32em; color: var(--accent); margin: 1.3em 0 .7em; text-align: center; }
.reader h3 { font-size: 1.1em; margin: 1.4em 0 .5em; }
.reader > :first-child { margin-top: .3em; }
.reader .front { text-align: center; color: var(--muted); margin-bottom: .3em; }
.reader table { border-collapse: collapse; width: 100%; }
.reader td, .reader th { border: 1px solid var(--line); padding: 4px 8px; }
.page-title { color: var(--muted); font-size: .9rem; text-align: center; margin: 4px 0 12px; overflow-wrap: anywhere; }

.pager { display: flex; align-items: stretch; gap: 8px; margin-top: 16px; }
.pager a, .pager span.gap { flex: 1; min-width: 0; }
.pager a {
  display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-weight: 700;
}
.pager a:hover { background: var(--surface2); }
.pager a.next { text-align: right; }
.pager small { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.position { text-align: center; color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
