*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gray-50:  #F1EFE8;
  --gray-100: #D3D1C7;
  --gray-200: #B4B2A9;
  --gray-400: #888780;
  --gray-600: #5F5E5A;
  --gray-800: #444441;
  --gray-900: #2C2C2A;

  --bg:         var(--gray-900);
  --bg-surface: var(--gray-800);
  --bg-card:    #333331;
  --border:     var(--gray-600);
  --text:       var(--gray-50);
  --text-muted: var(--gray-200);
  --text-faint: var(--gray-400);
  --accent:     var(--gray-100);

  --font-body: 'Ubuntu Sans', 'Ubuntu', system-ui, sans-serif;
  --font-mono: 'Ubuntu Mono', 'Courier New', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ── Layout ── */
.site-header {
  border-bottom: 0.5px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-header .logo {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}
.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
}
.site-header nav a {
  color: var(--text-muted);
}
.site-header nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.site-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .site-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  /* sidebar flows below main content, no sticky */
  .sidebar {
    order: 2;
    position: static;
    top: auto;
    gap: 1rem;
  }

  main {
    order: 1;
  }

  /* profile stacks more compactly on small screens */
  .profile-top {
    gap: 0.75rem;
  }

  /* sidebar card slightly tighter padding */
  .sidebar-card {
    padding: 0.875rem 1rem;
  }

  /* post article full width, no max-width constraint */
  .post-article {
    max-width: 100%;
  }

  /* header tighter */
  .site-header {
    padding: 0.875rem 1rem;
  }

  /* prevent post images from overflowing */
  .post img,
  .post-article img {
    max-width: 100%;
    height: auto;
  }

  /* footer padding reduced */
  footer {
    padding: 1.25rem 1rem;
  }
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Profile / sidebar header ── */
.profile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.profile-top {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.profile-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-name h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}
.profile-name span {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0.01em;
}
.profile-tagline {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.profile-tagline strong {
  color: var(--text);
  font-weight: 500;
}
.mantra {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mantra-item {
  font-size: 0.6875rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.mantra-sep {
  font-size: 0.6875rem;
  color: var(--bg-surface);
}

/* ── Sidebar card ── */
.sidebar-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.sidebar-card h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}
.sidebar-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.sidebar-card strong {
  color: var(--text);
  font-weight: 500;
}
.sidebar-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sidebar-card ul li strong {
  color: var(--text);
  font-weight: 500;
}
.sidebar-card hr {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 0.875rem 0;
}

/* ── Tags ── */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.25rem;
}
.tag {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Post cards ── */
.post-grid {
  display: grid;
  gap: 1.25rem;
}
.post {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
  margin-bottom: 30px;
}
.post:hover {
  border-color: var(--gray-400);
}
.post a {
  display: block;
  color: inherit;
}
.post a:hover {
  text-decoration: none;
}
.post img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--bg-surface);
}
.post-body {
  padding: 1rem 1.25rem 1.25rem;
}
.post-body h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}
.post-body p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
/* — postcard meta */
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.reading-time {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}
/* ── Blog post view ── */
.post-article {
  max-width: 700px;
}
.post-article img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  background: var(--bg-surface);
}
/* post-level meta, tldr, tags */
.post-article h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tldr {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-left: 2px solid var(--gray-400);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tldr-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.tldr p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.post-article h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 0.75rem; color: var(--text); }
.post-article h3 { font-size: 1.0625rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); }
.post-article p  { margin-bottom: 1.1rem; color: var(--text-muted); }
.post-article ul,
.post-article ol { margin: 0 0 1rem 1.5rem; color: var(--text-muted); }
.post-article li { margin-bottom: 0.35rem; }
.post-article code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--accent);
}
.post-article pre {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.post-article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.post-article blockquote {
  border-left: 2px solid var(--border);
  border-radius: 0;
  margin: 1.5rem 0;
  padding: 0.5rem 1.25rem;
  color: var(--text-faint);
  font-style: italic;
}
.post-article a { color: var(--accent); }
.post-article hr {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 2rem 0;
}

/* ── Home intro ── */
.home-intro {
  margin-bottom: 2rem;
}
.home-intro h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.home-intro p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ── Footer ── */
footer {
  border-top: 0.5px solid var(--border);
  text-align: center;
  padding: 1.5rem 2rem;
  font-size: 0.8125rem;
  color: var(--text-faint);
}
