:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #161b22;
  --surface-strong: #1d2430;
  --surface-soft: #111820;
  --border: #2c3440;
  --border-strong: #3a4655;
  --text: #e8edf2;
  --muted: #a7b0bd;
  --subtle: #7f8a99;
  --accent: #4f9cf9;
  --accent-strong: #7ab7ff;
  --green: #39d98a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  --radius: 8px;
  --max-width: 1040px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

p {
  margin: 0 0 1rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.2rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(14px);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max-width);
  min-height: 64px;
  margin: 0 auto;
  padding: 0 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.86rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: var(--surface-strong);
  color: var(--text);
}

.site-shell {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 1.25rem;
  width: min(100% - 2rem, var(--max-width));
  margin: 1.25rem auto 3rem;
  align-items: start;
}

.profile-sidebar {
  position: sticky;
  top: 84px;
}

.content {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.avatar {
  width: 72px;
  height: 72px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-soft);
}

.profile-panel h2 {
  margin-top: 0.75rem;
  font-size: 1rem;
}

.profile-links {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.profile-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.profile-links a:hover {
  color: var(--accent-strong);
}

.eyebrow {
  margin-bottom: 0.55rem;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-block {
  display: grid;
  gap: 1rem;
}

.section-heading {
  padding: 0.4rem 0.2rem 0;
}

.section-heading h1,
.section-heading h2 {
  margin-bottom: 0.55rem;
}

.section-intro {
  max-width: 42rem;
}

.post-feed {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.post-card {
  border-bottom: 1px solid var(--border);
  padding: 1.35rem 0.2rem;
  transition: background 160ms ease;
}

.post-card:hover {
  background: rgba(255, 255, 255, 0.018);
}

.post-card h2,
.post-card h3 {
  margin: 0.35rem 0 0.7rem;
}

.post-card h2 a,
.post-card h3 a {
  display: inline;
}

.post-card p {
  max-width: 42rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: var(--subtle);
  font-size: 0.9rem;
  font-weight: 700;
}

.post-meta span::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--border-strong);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.tag-list span {
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0.3rem 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.post-view {
  max-width: 760px;
}

.post-header {
  border-bottom: 1px solid var(--border);
  padding: 0.2rem 0.2rem 1.5rem;
}

.post-header h1 {
  margin-top: 0.8rem;
}

.post-content {
  padding: 1.5rem 0.2rem 0;
}

.post-content h2,
.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

.post-content p,
.post-content ul,
.post-content ol {
  margin-top: 0;
  margin-bottom: 1.1rem;
}

.post-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post-content code {
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 0.15rem 0.35rem;
  color: var(--green);
}

.post-content pre {
  max-width: 100%;
  margin: 0 0 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 1rem;
}

.post-content pre code {
  display: block;
  min-width: max-content;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  white-space: pre;
}

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

  .top-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.75rem 1rem;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .nav-links a {
    white-space: nowrap;
  }

  .site-shell {
    grid-template-columns: 1fr;
    width: min(100% - 1rem, var(--max-width));
    margin-top: 0.75rem;
  }

  .profile-sidebar {
    position: static;
  }

  .profile-sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }

  .profile-panel {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: center;
  }

  .profile-panel .avatar {
    grid-row: span 2;
    width: 52px;
    height: 52px;
  }

  .profile-panel h2 {
    margin-top: 0;
  }

  .profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    margin-top: 0.25rem;
  }

  .post-header,
  .post-content {
    padding: 1.25rem;
  }
}

@media (max-width: 460px) {
  body {
    font-size: 15px;
  }

  h1 {
    font-size: 1.35rem;
  }

  .brand {
    width: 100%;
  }

  .post-card {
    padding: 1rem;
  }
}
