/*
  Single-source stylesheet: element-first, mobile-first
  - No legacy book.css or site.css dependencies
  - Theme via html.light / html.dark classes
*/

/* Theme variables */
:root {
  --bg: #0f1115;
  --surface: #181b21;
  --text: #e6e6e6;
  --muted: #9aa3af;
  --accent: #ff3366;
  --link: #7aa2ff;
  --border: #2a2f3a;
}
html.light {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1a1a1a;
  --muted: #606770;
  --accent: #c3184f;
  --link: #1a73e8;
  --border: #e5e7eb;
}
html.dark {
  --bg: #0f1115;
  --surface: #181b21;
  --text: #e6e6e6;
  --muted: #9aa3af;
  --accent: #ff3366;
  --link: #7aa2ff;
  --border: #2a2f3a;
}

/* Root & layout */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}
body {
  font-family: system-ui,-apple-system,Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  margin: 0.6em 0 0.4em;
  line-height: 1.25;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }

/* Paragraphs & lists */
p { margin: 0.9em 0; }
ol, ul { margin: 0.8em 0; padding-left: 1.2em; }
li { margin: 0.4em 0; }

/* Media */
img, svg { max-width: 100%; height: auto; }

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; }
.brand .brand-text { font-weight: 600; }
.muted { color: var(--muted); }
nav[aria-label] { display: none; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Main */
main {
  display: block;
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* Footer */
footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Buttons */
button, .btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn.donate { background: var(--accent); color: #fff; border-color: transparent; }

/* Pagination */
.pagination { display: flex; gap: 8px; margin: 16px 0; }
.pagination a { border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; }

/* Index list */
ol.index { padding-left: 1.2em; }
ol.index a { color: var(--link); }

/* Utilities */
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.divider { border-top: 1px solid var(--border); }

/* Responsive */
@media (min-width: 768px) {
  nav[aria-label] { display: flex; gap: 10px; }
  header { padding: 12px 20px; }
  main { padding: 24px; }
}
/* styles.css — merged stylesheet (migrated from site.css)
   This file currently contains the site layout + theme variables.
   If you want to centralize all CSS, we can also copy book.css content here later.
*/
:root{
  --site-bg: transparent;
  --site-surface: rgba(255,255,255,0.02);
  --site-text: inherit;
  --accent: #e34b3b;
  --muted: #9ea3a6;
}

/* Theme variants: default uses system/dark; .light overrides */
html.light {
  --site-surface: rgba(255,255,255,0.96);
  --site-text: #111827;
  --accent: #c4272f;
  --muted: #6b7280;
}

html.dark {
  --site-surface: rgba(255,255,255,0.02);
  --site-text: #e9e9e9;
  --accent: #e34b3b;
  --muted: #9ea3a6;
}

/* Small layout for header/nav/footer */
header{
  display:flex;
  align-items:center;
  gap:16px;
  padding:10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: var(--site-surface);
  backdrop-filter: blur(4px);
}

/* skip link for keyboard users */
.skip-link{
  position:absolute;
  left:-9999px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}
.skip-link:focus{
  left:12px;
  top:12px;
  width:auto;
  height:auto;
  padding:8px 12px;
  background:rgba(0,0,0,0.6);
  color:white;
  border-radius:6px;
  z-index:1000;
}

.brand{ display:flex; align-items:center; gap:10px }
.brand-link{ display:inline-flex; align-items:center; gap:8px; text-decoration:none; color:var(--site-text) }
.brand img{ width:28px; height:28px; display:inline-block }
.brand-text{ font-weight:700; font-size:1rem }
.brand small{ display:block; color:var(--muted); font-size:0.8rem }

nav[aria-label]{ display:flex; gap:12px; align-items:center; margin-left:8px }
nav[aria-label] a{ color:var(--muted); text-decoration:none; font-size:0.95rem }
nav[aria-label] a:hover{ color:var(--accent); text-decoration:underline }

.header-actions{ margin-left:auto; display:flex; gap:8px; align-items:center }
.header-actions .btn{ padding:6px 10px; border-radius:8px; background:transparent; color:var(--accent); border:1px solid rgba(227,75,59,0.12); text-decoration:none }
.header-actions .btn:hover{ background:rgba(227,75,59,0.06) }
.header-actions .donate{ background:var(--accent); color:white; border:0; padding:6px 12px }

main{ padding-top:8px }

footer{
  margin-top:28px;
  padding:18px 16px;
  border-top:1px solid rgba(255,255,255,0.03);
  font-size:0.9rem;
  color:var(--muted);
  text-align:center;
}

/* small helper classes */
.container{ max-width:720px; margin:0 auto; padding:0 16px }
.center{ text-align:center }
.btn{ display:inline-block; padding:6px 10px; border-radius:6px; background:transparent; color:var(--accent); text-decoration:none }

/* ensure donate button remains visible */
a.donate{ font-weight:700 }

@media (min-width:768px){
  header{ padding:14px 28px }
  nav[aria-label]{ margin-left:18px }
}

@media (max-width:640px){
  header{ flex-wrap:wrap; align-items:center }
  .brand{ flex:1 1 100% }
  nav[aria-label]{ order:3; width:100%; gap:10px; padding:6px 0 }
  .header-actions{ order:2 }
}
