/* MyCelium wiki. Plain and fast: system fonts, flat colors, no gradients. */
:root {
  --bg: #ffffff;
  --text: #232323;
  --muted: #5f5f5f;
  --accent: #d32f2f;
  --accent-dark: #b71c1c;
  --border: #e0e0e0;
  --code-bg: #f4f4f4;
  --note-bg: #fdecea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  font-size: 16px;
}

/* Chunky rounded type for headings, nav, and buttons. Falls back gracefully. */
h1, h2, h3, h4, .site-title, .sidebar, .icon-btn, .card h3 {
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Segoe UI", system-ui, sans-serif;
}

h1 { letter-spacing: 0.01em; }
h2 { letter-spacing: 0.01em; }

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }

/* Top bar: slim, just title + buttons. Navigation lives in the sidebar. */
.site-header {
  background: var(--accent-dark);
  color: #fff;
  padding: 0.55rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 4px solid rgba(0, 0, 0, 0.25);
}

.site-header .wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-title {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.3rem;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}

.site-title:hover { color: #fff; }

.site-logo {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #fff;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-bottom-width: 4px;
  color: #fff;
  border-radius: 12px;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.28); }
.icon-btn:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}
.icon-btn svg { width: 1.3rem; height: 1.3rem; }

.menu-btn { display: none; }

/* Only one icon shows at a time, depending on the theme. */
.theme-btn .sun { display: none; }
[data-theme="dark"] .theme-btn .sun { display: block; }
[data-theme="dark"] .theme-btn .moon { display: none; }

/* Page layout: sidebar + content. */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 3.4rem;
  max-height: calc(100vh - 3.4rem);
  overflow-y: auto;
  padding: 1.4rem 1rem 3rem 1.25rem;
  border-right: 1px solid var(--border);
  font-size: 0.93rem;
}

.sidebar section { margin-bottom: 1.3rem; }

.sidebar h4 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li { margin: 0; }

.sidebar a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 2px solid transparent;
}

.sidebar a:hover { background: var(--code-bg); color: var(--text); border-color: var(--border); }
.sidebar a.active { background: var(--accent-dark); color: #fff; font-weight: 700; border-color: rgba(0, 0, 0, 0.25); }
[data-theme="dark"] .sidebar a.active { color: #fff; }

/* Page */
main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2rem 4rem;
}

h1 { font-size: 2.1rem; margin-top: 0; font-weight: 800; }
h2 { margin-top: 2.2rem; border-bottom: 3px solid var(--border); padding-bottom: 0.35rem; font-weight: 800; }
h3 { margin-top: 1.6rem; }

p, li { max-width: 70ch; }

.meta { color: var(--muted); font-size: 0.9rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 14px;
  overflow-x: auto;
  border: 2px solid var(--border);
}

pre code { background: none; padding: 0; }

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 1rem 0;
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

th { background: var(--code-bg); }

/* Code block syntax highlighting. Colors stay readable in both themes. */
.tok-k { color: #0b5cad; }
.tok-s { color: #1a7f37; }
.tok-c { color: #6e6e6e; font-style: italic; }
.tok-n { color: #8250df; }
.tok-a { color: #953800; }

[data-theme="dark"] .tok-k { color: #79b8ff; }
[data-theme="dark"] .tok-s { color: #7ee787; }
[data-theme="dark"] .tok-c { color: #8b949e; }
[data-theme="dark"] .tok-n { color: #d2a8ff; }
[data-theme="dark"] .tok-a { color: #ffa657; }

.note {
  background: var(--note-bg);
  border: 2px solid var(--accent);
  border-left-width: 8px;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  margin: 1.2rem 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] .card { box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4); }

.card h3 { margin-top: 0; }
.card p { margin-bottom: 0; }

.steps li { margin-bottom: 0.6rem; }

footer {
  border-top: 1px solid var(--border);
  padding: 1.6rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

footer .wrap { max-width: 1200px; margin: 0 auto; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.footer-grid h4 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-grid li { margin: 0.25rem 0; }
.footer-grid a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* Dark mode. */
[data-theme="dark"] {
  --bg: #171717;
  --text: #e6e6e6;
  --muted: #a3a3a3;
  --accent: #ef5350;
  --accent-dark: #b71c1c;
  --border: #383838;
  --code-bg: #262626;
  --note-bg: #2b1a1a;
  color-scheme: dark;
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    max-height: none;
    width: 270px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding-top: 4.2rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 15;
  }

  body.sidebar-open .sidebar { transform: none; }

  main { padding: 1.4rem 1rem 3rem; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
}
