:root {
  --bg: #efefed;
  --bg-shade: #e5e5e1;
  --text: #222226;
  --muted: #5f5f63;
  --line: #3a3a3f;
  --surface: #f5f5f5;
  --accent: #3d77bf;
}

[data-theme="dark"] {
  --bg: #0d0d0f;
  --bg-shade: #111116;
  --text: #e8e8ec;
  --muted: #8a8a92;
  --line: #2c2c34;
  --surface: #16161c;
  --accent: #6b9fd4;
}

* {
  box-sizing: border-box;
}

::selection {
  color: var(--surface);
  background: var(--line);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

#binary-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

a {
  color: inherit;
}

.site-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  min-height: 100vh;
}

@media (min-width: 800px) {
  .site-container {
    flex-direction: row-reverse;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }
}

.site-sidebar {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.2rem;
  border-bottom: 2px solid var(--line);
  background: transparent;
}

@media (min-width: 800px) {
  .site-sidebar {
    width: 340px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    padding: 2.5rem 2rem;
    border-bottom: none;
    border-left: 2px solid var(--line);
    background: transparent;
    align-items: center;
    text-align: center;
    justify-content: center;
  }
}

.site-header {
  border-bottom: none;
  padding: 0;
  width: 100%;
}

.header-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
}

@media (min-width: 800px) {
  .brand-block {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
}

.brand-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

@media (min-width: 800px) {
  .brand-content {
    align-items: center;
  }
}

.profile-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%;
  flex-shrink: 0;
}

@media (min-width: 800px) {
  .profile-avatar {
    width: 4.5rem;
    height: 4.5rem;
  }
}

.site-title {
  display: inline-block;
  text-decoration: none;
  font-size: 1.5rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
  line-height: 1;
}

@media (min-width: 800px) {
  .site-title {
    font-size: 2.35rem;
    line-height: 0.95;
  }
}

.site-tagline {
  margin: 0;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
  width: 100%;
}

@media (min-width: 800px) {
  .header-actions {
    align-items: center;
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
  }
}

.social-icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 0.5rem;
  width: 100%;
}

.social-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.82;
  transition: color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.social-icon-link svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

.social-icon-link:hover {
  opacity: 1;
  color: var(--accent);
  transform: translateY(-1px);
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.35rem 0.85rem;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  opacity: 0.8;
  transition: color 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.home-btn svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
  flex-shrink: 0;
}

.home-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0.85rem;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  cursor: pointer;
  opacity: 0.8;
  transition: color 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.theme-toggle svg {
  width: 0.88rem;
  height: 0.88rem;
  fill: currentColor;
  flex-shrink: 0;
}

.theme-toggle:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

/* Show moon in light mode, sun in dark mode */
.icon-sun  { display: none; }
.icon-moon { display: inline; }
[data-theme="dark"] .icon-sun  { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }

.page-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.2rem;
  background: transparent;
}

@media (min-width: 800px) {
  .page-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem;
    max-width: none;
    background: transparent;
  }
}

.panel {
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.8rem, 5.2vw, 2.9rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.65rem;
}

p {
  margin: 0.5rem 0;
  max-width: 64ch;
}

ul {
  margin: 0.2rem 0 0;
  padding-left: 0;
  list-style: none;
}

li {
  padding: 0.32rem 0;
}

.quick-links a,
.social-links a,
.posts-list a {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.quick-links a:hover,
.social-links a:hover,
.posts-list a:hover {
  color: var(--accent);
}

.posts-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  border-bottom: 1px dashed #c3b8a8;
}

.posts-list small {
  flex: 0 0 auto;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  color: var(--muted);
  font-size: 0.75rem;
}

.post-entry-main {
  min-width: 0;
}

.post-cats {
  margin-top: 0.1rem;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: lowercase;
}

.post {
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 1.25rem;
}

.post header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
}

.post-meta {
  color: var(--muted);
  margin: 0;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

.post code,
.post pre {
  font-family: "IBM Plex Mono", "Courier New", monospace;
}

.post pre {
  background: #1e1f24;
  color: #f3f4f6;
  border: 1px solid #2d2f36;
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  overflow-x: auto;
}

.post :not(pre) > code {
  background: #f4efe3;
  border: 1px solid #dfd6c4;
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
}

.highlight .k,
.highlight .kd,
.highlight .kr,
.highlight .kt { color: #ff7a90; }
.highlight .nf,
.highlight .nc,
.highlight .fm { color: #7dcfff; }
.highlight .s,
.highlight .s1,
.highlight .s2 { color: #9ece6a; }
.highlight .mi,
.highlight .m { color: #ff9e64; }
.highlight .c,
.highlight .c1,
.highlight .cm { color: #7a8194; }
.highlight .nb,
.highlight .bp,
.highlight .o,
.highlight .p { color: #c0caf5; }

.site-footer {
  border-top: 2px solid var(--line);
  margin-top: auto;
  padding: 0.45rem 0 0.8rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.35;
}



.stagger {
  animation: riseIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.12s; }
.stagger-3 { animation-delay: 0.2s; }
.stagger-4 { animation-delay: 0.28s; }

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stagger {
    animation: none;
    transform: none;
  }
}

@media (max-width: 700px) {
  .header-grid {
    display: block;
  }

  .brand-block {
    align-items: flex-start;
  }

  .title-row {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }

  .site-nav {
    margin-top: 0.8rem;
    justify-content: flex-start;
    gap: 0.65rem;
  }

  .posts-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }
}
