/* ── Tokens ── */
:root {
  --bg:      #1C1917;
  --surface: #28231F;
  --border:  #3a3330;
  --text:    #E8DDD0;
  --muted:   #8a7f76;
  --accent:  #D4A574;
  --tag-bg:  #2e2925;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Page container ── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

/* ── Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2.5rem;
}

.site-name {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.about-btn {
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.about-btn:hover,
.about-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ── Main nav ── */
nav {
  display: flex;
  gap: 1.8rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

nav button {
  background: none;
  border: none;
  padding: 0 0 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.01em;
  margin-bottom: -0.76rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

nav button:hover { color: var(--text); }

nav button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── Tab sections ── */
.tab-section { display: none; }

.tab-section.active {
  display: block;
  animation: fadein 0.15s ease;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Two-column landing ── */
.landing-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 3rem;
  align-items: start;
}

.lately {
  border-left: 1px solid var(--border);
  padding-left: 2rem;
}

.lately-block + .lately-block {
  margin-top: 1.8rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
}

.lately-block ul { list-style: none; }

.lately-block li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.lately-block li:last-child { border-bottom: none; }
.lately-block a:hover { text-decoration: underline; }

/* ── Post list ── */
.post-list { list-style: none; }

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.post-list li:last-child { border-bottom: none; }

.post-list a { font-size: 0.93rem; }
.post-list a:hover { text-decoration: underline; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.post-date {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

.tag {
  font-size: 0.66rem;
  color: var(--muted);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 2px;
}

/* ── Section label ── */
.section-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

/* ── Link list (reading / listening) ── */
.link-list { list-style: none; }

.link-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.link-list li:last-child { border-bottom: none; }

.link-list a { font-size: 0.92rem; }
.link-list a:hover { text-decoration: underline; }

.link-list .source {
  font-size: 0.73rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Reading sub-nav ── */
.sub-nav {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.sub-btn {
  background: none;
  border: none;
  padding: 0 0 0.6rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -0.61rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.sub-btn:hover { color: var(--text); }

.sub-btn.active {
  color: var(--text);
  border-bottom-color: var(--border);
}

.sub-section { display: none; }

.sub-section.active {
  display: block;
  animation: fadein 0.15s ease;
}

/* ── Book groups ── */
.book-group + .book-group {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.book-group-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

/* ── Repo list ── */
.repo-list { list-style: none; }

.repo-list li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.repo-list li:last-child { border-bottom: none; }

.repo-list > li > a {
  font-size: 0.9rem;
  font-weight: 500;
}

.repo-list a:hover { text-decoration: underline; }

.repo-desc {
  font-size: 0.79rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.repo-lang {
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.repo-lang .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Empty state ── */
.empty-state {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 1rem 0;
}

/* ── About overlay ── */
.about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
}

.about-overlay.open { display: block; }

.about-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(360px, 90vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 2.5rem 2rem;
  overflow-y: auto;
  animation: panelslide 0.22s ease;
}

@keyframes panelslide {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.about-close {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.about-close:hover { color: var(--text); }

.about-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 1.3rem;
}

.about-panel p {
  font-size: 0.86rem;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.8;
  margin-bottom: 0.8rem;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.skill-pill {
  font-size: 0.68rem;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 7px;
  color: var(--muted);
}

/* ── Post page ── */
.post-article { max-width: 640px; }

.back-link {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  color: var(--text);
  border-bottom-color: var(--border);
  text-decoration: none;
}

.post-title {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.post-header-meta .post-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.post-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.post-content {
  font-size: 0.95rem;
  line-height: 1.85;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
  font-weight: 600;
}

.post-content h2 { font-size: 1.1rem; }
.post-content h3 { font-size: 0.98rem; }

.post-content p { margin-bottom: 1.2rem; }

.post-content ul,
.post-content ol {
  margin-bottom: 1.2rem;
  padding-left: 1.4rem;
}

.post-content li { margin-bottom: 0.3rem; }

.post-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--accent);
}

.post-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.2rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.post-content blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--accent);
}

.post-content a:hover { opacity: 0.8; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Tags page ── */
.tags-container { max-width: 640px; }

.tags-container h1 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2rem;
}

.tag-section { margin-bottom: 2.5rem; }

.tag-section h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.tag-section ul { list-style: none; }

.tag-section li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.tag-section li:last-child { border-bottom: none; }

.tag-section li span {
  font-size: 0.73rem;
  color: var(--muted);
  flex-shrink: 0;
}

.tag-section a:hover { text-decoration: underline; }

/* ── Footer ── */
footer {
  margin-top: 3.5rem;
  display: flex;
  gap: 1.2rem;
  font-size: 0.73rem;
  color: var(--muted);
}

footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .page { padding: 2rem 1.2rem 4rem; }

  .landing-grid {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .lately {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 1.8rem;
    margin-top: 1.8rem;
  }

  nav { gap: 1.2rem; overflow-x: auto; }
  nav button { white-space: nowrap; flex-shrink: 0; }

  .about-panel { width: 100vw; }
}
