@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #f8f8f6;
  --bg-subtle: #f0f0ec;
  --border: #d8d8d0;
  --text: #1a1a1a;
  --text-muted: #666660;
  --accent: #4444aa;
  --accent-hover: #333388;
  --code-bg: #efefeb;
  --font: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

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

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

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

/* ── Layout ── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header / Nav ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-bottom: 3rem;
}

header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-title .cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .site-title .cursor { animation: none; }
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

nav a:hover,
nav a.active {
  color: var(--accent);
  text-decoration: none;
}

/* ── Main content ── */
main {
  padding-bottom: 4rem;
}

/* ── Section ── */
section {
  margin-bottom: 3rem;
}

section h2 {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Hero / Intro ── */
.intro {
  margin-bottom: 3rem;
}

.intro-name {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.intro-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ── About ── */
.about-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.about-photo {
  width: 160px;
  height: 200px;
  border-radius: 0;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background-image: url('/assets/avatar-glitch-cropped.png');
  background-size: cover;
  background-position: center top;
}

.about-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.8;
}

/* ── Tech Stack ── */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack-group {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.stack-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 9ch;
  flex-shrink: 0;
}

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

.tag {
  font-size: 0.78rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.2em 0.55em;
  color: var(--text);
}

/* ── Experience ── */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.exp-item {}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.exp-role {
  font-size: 0.95rem;
  font-weight: 500;
}

.exp-company {
  color: var(--accent);
}

.exp-dates {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.exp-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Writing & Work ── */
.writing-list {
  display: flex;
  flex-direction: column;
}

.writing-item {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

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

.writing-item:last-child {
  border-bottom: none;
}

.writing-item:hover .writing-title {
  color: var(--accent);
}

.writing-meta {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.writing-source {
  font-size: 0.78rem;
  color: var(--accent);
}

.writing-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.writing-title {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  transition: color 0.1s;
}

.writing-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Contact ── */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-list li {
  font-size: 0.9rem;
  display: flex;
  gap: 0.75rem;
}

.contact-label {
  color: var(--text-muted);
  min-width: 8ch;
  display: inline-block;
}

/* ── Blog list ── */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.blog-list-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color 0.1s;
}

.blog-list-item:hover {
  color: var(--accent);
  text-decoration: none;
}

.blog-list-item:last-child {
  border-bottom: none;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.post-title {
  font-size: 0.95rem;
}

.post-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Blog post content ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-body h1 { font-size: 1.4rem; }
.post-body h2 { font-size: 1.15rem; }
.post-body h3 { font-size: 1rem; }
.post-body h4 { font-size: 0.95rem; color: var(--text-muted); }

.post-body p {
  margin-bottom: 1.25rem;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25rem 1.5rem;
}

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

.post-body blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-style: italic;
}

.post-body blockquote p {
  margin-bottom: 0;
}

.post-body code {
  font-family: var(--font);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--text);
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
  line-height: 1.6;
}

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

.post-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body img {
  max-width: 100%;
  border-radius: 4px;
  margin: 1rem 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-body th {
  font-weight: 500;
  color: var(--text-muted);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.page-btn {
  font-family: var(--font);
  font-size: 0.82rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.3em 0.75em;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  background: var(--code-bg);
}

.page-btn:disabled {
  color: var(--text-muted);
  cursor: default;
}

.page-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Back link ── */
.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

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

/* ── Error / loading ── */
.status-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 1rem 0;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
}

footer .container {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Responsive ── */

/* Tablet / large mobile (≤ 600px) */
@media (max-width: 600px) {
  header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  nav {
    gap: 1rem;
  }

  .container {
    padding: 0 1.25rem;
  }

  .post-header h1 {
    font-size: 1.25rem;
  }
}

/* Small mobile (≤ 480px) */
@media (max-width: 480px) {
  html { font-size: 13px; }

  .about-wrap { flex-direction: column; gap: 1rem; }

  .intro-name { font-size: 1.35rem; }

  .exp-header { flex-direction: column; gap: 0.1rem; }

  .blog-list-item { flex-direction: column; gap: 0.2rem; }

  .contact-list li { flex-direction: column; gap: 0.1rem; }

  .post-body pre { padding: 0.75rem; }
}
