/* === Theme Variables === */
:root[data-theme="dark"] {
  --bg: #1e1e2e;
  --bg-secondary: #262637;
  --bg-card: #2a2a3d;
  --text: #cdd6f4;
  --text-muted: #9399b2;
  --heading: #f0f0f5;
  --link: #df51a7;
  --link-hover: #f080c0;
  --border: #3a3a52;
  --sidebar-bg: #181825;
  --sidebar-active: #df51a7;
  --toggle-icon-sun: none;
  --toggle-icon-moon: inline;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-card: #ffffff;
  --text: #2c2c2e;
  --text-muted: #6e6e73;
  --heading: #1d1d1f;
  --link: #c02080;
  --link-hover: #a01868;
  --border: #d2d2d7;
  --sidebar-bg: #f5f5f7;
  --sidebar-active: #c02080;
  --toggle-icon-sun: inline;
  --toggle-icon-moon: none;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

/* === Layout === */
.layout { display: flex; min-height: 100vh; }

/* === Sidebar === */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.site-title {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--heading);
  text-decoration: none;
}
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
}
#theme-toggle:hover { border-color: var(--link); }
.icon-sun { display: var(--toggle-icon-sun); }
.icon-moon { display: var(--toggle-icon-moon); }
.nav-list { list-style: none; }
.nav-list li { margin-bottom: 2px; }
.nav-list a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.nav-list a:hover { color: var(--heading); background: var(--bg-secondary); }
.nav-list a.active { color: var(--sidebar-active); background: var(--bg-secondary); font-weight: 600; }

/* === Main Content === */
.content {
  flex: 1;
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 2.5rem;
  min-width: 0;
}
.content > article > h1 { font-size: 2rem; color: var(--heading); margin-bottom: 0.5rem; }
.content > article > h2 { font-size: 1.3rem; color: var(--heading); margin-top: 1.5rem; margin-bottom: 0.5rem; }
.content > article > p { margin-bottom: 1rem; }
.content > article > ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.content a { color: var(--link); text-decoration: none; }
.content a:hover { text-decoration: underline; color: var(--link-hover); }
.content strong { color: var(--heading); }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* === PDF List === */
.pdf-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 1rem;
}
.pdf-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s;
}
.pdf-card:hover { border-color: var(--link); text-decoration: none; }
.pdf-icon { color: var(--text-muted); flex-shrink: 0; }
.pdf-card:hover .pdf-icon { color: var(--link); }
.pdf-name { color: var(--heading); font-weight: 500; font-size: 0.95rem; flex: 1; }
.pdf-pages { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }

/* === Responsive === */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
  }
  .nav-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-list a { padding: 4px 8px; font-size: 0.85rem; }
  .content { padding: 1.5rem 1rem; }
}
