/* huytieu.com — sidebar + vertical feed */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #fbfcff;
  --text: #111827;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-strong: #1d4ed8;
  --sidebar-width: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'JetBrains Mono', 'SFMono-Regular', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Layout: sidebar + main ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 36px 24px 32px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.sidebar-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.sidebar-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-align: center;
}

.sidebar-bio {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
  margin: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--accent-strong);
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.tag-pill:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.sidebar-contact {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 4px;
}

.sidebar-contact a {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
}

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

/* ---------- Main content ---------- */

.main {
  padding: 40px 48px 80px;
  max-width: 820px;
  margin: 0 auto;
}

/* ---------- Feed (vertical list) ---------- */

.feed {
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.feed-item:first-child {
  padding-top: 0;
}

.feed-ascii {
  font-size: 10px;
  line-height: 1.2;
  color: var(--accent);
  margin: 0;
  padding: 4px 0 0;
  background: none;
  opacity: 0.5;
  width: 80px;
  flex-shrink: 0;
  text-align: center;
  overflow: hidden;
}

.feed-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.feed-body > * {
  flex-shrink: 0;
}

.feed-title {
  display: block;
  width: 100%;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px;
  transition: color 150ms ease;
}

.feed-excerpt {
  display: block;
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 10px;
}

.feed-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.feed-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.feed-tag {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-decoration: none;
}

.feed-tag:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.tag-filter-label {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
}

.tag-clear {
  font-size: 12px;
  margin-left: 8px;
}

.feed-votes {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.feed-meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-left: auto;
}

.feed-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  margin-bottom: 6px;
}

/* ---------- Page titles ---------- */

.page-title {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 12px;
}

.page-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 32px;
  max-width: 640px;
}

/* ---------- Post detail ---------- */

.post {
  max-width: 720px;
}

.post h1 {
  font-size: clamp(26px, 3.5vw, 38px);
  margin: 12px 0 12px;
  line-height: 1.25;
}

.post-header {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: 16px 0 4px;
}

.post-header-body {
  flex: 1;
  min-width: 0;
}

.post-header-body h1 {
  margin: 0 0 8px;
}

.post-header-body .post-meta {
  margin: 0 0 10px;
}

.post-header-body .post-tags {
  margin: 0;
  padding: 0;
  border: none;
}

.post-ascii {
  font-size: 10px;
  line-height: 1.2;
  color: var(--accent);
  margin: 0;
  padding: 12px 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  opacity: 0.7;
  flex-shrink: 0;
  text-align: center;
}

.post-meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}

.post-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.post-tag {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  text-decoration: none;
}

.post-tag:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.post-reactions {
  display: flex;
  gap: 12px;
  margin: 40px 0 32px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 150ms ease;
}

.vote-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.vote-btn.voted {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.post-comments {
  margin-top: 8px;
}

.giscus {
  margin-top: 16px;
}

.post-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin: 20px 0 28px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.back-link {
  text-decoration: none;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.back-link:hover {
  color: var(--accent-strong);
}

.post-content {
  font-size: 16px;
  line-height: 1.75;
}

.post-content p { margin: 0 0 20px; }
.post-content h2 { font-size: 22px; margin: 40px 0 14px; }
.post-content h3 { font-size: 18px; margin: 32px 0 10px; }

.post-content a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}
.post-content a:hover { border-bottom-color: var(--accent); }
.post-content strong { color: var(--text); }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
  margin: 24px 0;
}

.post-content code {
  background: rgba(37, 99, 235, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-content pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 18px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 24px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ---------- Generic page ---------- */

.page {
  max-width: 720px;
}

.page h1 {
  font-size: clamp(26px, 3.5vw, 38px);
  margin: 0 0 12px;
  line-height: 1.25;
}

.page-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.page-content { font-size: 16px; line-height: 1.75; }
.page-content p { margin: 0 0 18px; }
.page-content h2 { font-size: 22px; margin: 36px 0 12px; }
.page-content h3 { font-size: 18px; margin: 28px 0 10px; }
.page-content ul, .page-content ol { margin-left: 18px; }

.page-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
  margin: 24px 0;
}

.page-content code {
  background: rgba(37, 99, 235, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.page-content a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}
.page-content a:hover { border-bottom-color: var(--accent); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

td {
  color: var(--muted);
}

tr:last-child td {
  border-bottom: none;
}

/* ---------- Home sections ---------- */

.home-section {
  margin-bottom: 48px;
  position: relative;
}

.section-title {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.section-more {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  display: inline-block;
}

.section-more:hover {
  color: var(--accent-strong);
}

.home-cta {
  background: linear-gradient(135deg, var(--accent-soft), #f8fafc);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.home-cta h2 {
  font-size: 22px;
  margin: 0 0 10px;
}

.home-cta p {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
}

.cta-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cta-links a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cta-links a:hover {
  background: var(--accent);
  color: #fff;
}

.bento-compact {
  gap: 12px;
}

.bento-compact .bento-card h3 {
  font-size: 17px;
  margin: 0;
}

.bento-compact .bento-card p {
  font-size: 13px;
}

/* ---------- Bento grid (projects) ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.bento-featured {
  grid-column: 1 / -1;
}

.bento-chart {
  grid-column: 1 / -1;
  align-items: center;
}

.bento-chart img {
  max-width: 100%;
  border-radius: 8px;
}

.bento-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bento-lang {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
}

.bento-stars {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.bento-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.bento-card h2 {
  font-size: 20px;
  margin: 0;
}

.bento-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.bento-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bento-tags li {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
}

.bento-link {
  font-size: 13px;
  color: var(--accent-strong);
  margin-top: auto;
}

@media (max-width: 520px) {
  .bento {
    grid-template-columns: 1fr;
  }
}

/* ---------- Content images ---------- */

.page-content img,
.post-content img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  line-height: 1.3;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 20px 20px;
  }

  .sidebar-brand {
    flex-direction: row;
    gap: 12px;
  }

  .sidebar-avatar {
    width: 48px;
    height: 48px;
  }

  .sidebar-bio { display: none; }
  .sidebar-tags { display: none; }
  .sidebar-contact { display: none; }

  .sidebar-nav {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
  }

  .sidebar-nav a {
    white-space: nowrap;
    padding: 4px 8px;
  }

  .main {
    padding: 28px 20px 60px;
  }
}

@media (max-width: 520px) {
  .feed-item { grid-template-columns: 1fr; }
  .feed-ascii { display: none; }
  .feed-title { font-size: 18px; }
  .feed-excerpt { font-size: 13px; }
  .post h1, .page h1 { font-size: 24px; }
  .bento { grid-template-columns: 1fr; }
}
