:root {
  --bg: #f4f4f5;
  --ink: #18181b;
  --muted: #71717a;
  --accent: #0f766e;
  --card: #ffffff;
  --line: #e4e4e7;
  --sidebar: #18181b;
  --sidebar-text: #a1a1aa;
  --sidebar-active: #fafafa;
  --sidebar-hover: #27272a;
  --topbar: #ffffff;
  --sidebar-w: 16rem;
}
html[data-theme="dark"] {
  --bg: #09090b;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --card: #18181b;
  --line: #27272a;
  --topbar: #18181b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 1.25rem;
  vertical-align: middle;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}
body.sidebar-collapsed { --sidebar-w: 4.5rem; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-search input { display: none; }
body.sidebar-collapsed .sidebar-search { justify-content: center; }
body.sidebar-collapsed .nav-link { justify-content: center; }
body.sidebar-collapsed .brand { justify-content: center; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fafafa;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 0.35rem 0.5rem 0.85rem;
}
.brand-mark {
  color: #2dd4bf;
  font-size: 1.6rem;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #27272a;
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  margin: 0 0.25rem 0.75rem;
}
.sidebar-search input {
  border: 0;
  background: transparent;
  color: #fafafa;
  width: 100%;
  font: inherit;
  outline: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  overflow: auto;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-active); }
.nav-link[aria-current="page"] {
  background: #27272a;
  color: #2dd4bf;
}
.nav-link[hidden] { display: none; }

.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.sidebar-collapse:hover { background: var(--sidebar-hover); color: #fafafa; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0.25rem; }

.icon-btn, .profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0.5rem;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover, .profile-btn:hover { background: var(--bg); color: var(--ink); }
.mobile-menu { display: none; }

.menu { position: relative; }
.menu-panel {
  position: absolute;
  right: 0;
  top: 2.5rem;
  min-width: 11rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 0.25rem;
  z-index: 40;
}
.menu-panel button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.5rem 0.65rem;
  border-radius: 0.35rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.menu-panel button:hover { background: var(--bg); }

.site-main {
  max-width: 46rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}
h1 { margin: 0 0 0.75rem; font-size: 1.75rem; letter-spacing: -0.03em; }
.lede { font-size: 1.05rem; color: var(--muted); }
.note {
  margin-top: 2rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  border-left: 3px solid var(--accent);
}
.menu-panel a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  color: var(--ink);
  padding: 0.5rem 0.65rem;
  border-radius: 0.35rem;
  text-decoration: none;
  font-size: 0.9rem;
}
.menu-panel a:hover { background: var(--bg); }
.menu-panel form { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 1.25rem; }
.chip {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--card);
}
.chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.feed-empty, .muted { color: var(--muted); }
.section-title { font-size: 1.05rem; margin: 2rem 0 0.75rem; }
.plain-list { padding-left: 1.1rem; }
.stack-form { display: grid; gap: 0.75rem; max-width: 22rem; }
.stack-form p { margin: 0; display: grid; gap: 0.25rem; }
.stack-form input, .stack-form select {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  font: inherit;
  background: var(--card);
  color: var(--ink);
}
.btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 0.4rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
}
.stack-form textarea {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  font: inherit;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
.post-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem;
  margin: 0.75rem 0;
}
.post-card h3 { margin: 0.2rem 0 0.4rem; font-size: 1.05rem; }
.inline-form { display: inline; }
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.like-btn.is-on { color: #e11d48; }
.messages { list-style: none; padding: 0; color: #b45309; }

@media (max-width: 900px) {
  .mobile-menu { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s;
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-collapsed { --sidebar-w: 16rem; }
}
