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

:root {
  --bg: #111111;
  --text: #e8e4de;
  --text-secondary: #918a80;
  --text-tertiary: #5c574f;
  --accent: #b86f50;
  --accent-hover: #a05e42;
  --divider: rgba(232, 228, 222, 0.06);
  --col-gap: 24px;
  --cols: 12;
  --page-max: 1120px;
  --side-pad: 56px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(184, 111, 80, 0.2);
  color: var(--text);
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

/* Paper texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  background-size: 512px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.35;
}

/* Page */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--side-pad);
}

/* Header */
.header {
  padding-top: 64px;
  padding-bottom: 12px;
}

.header h1 {
  font-family: 'Newsreader', serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 2.875rem;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--text);
}

.header h1::after {
  content: '.';
  color: var(--accent);
}

.header .subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 10px;
  letter-spacing: 0.01em;
}

/* Nav */
.nav {
  padding: 24px 0 48px 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

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

.nav a:hover::after {
  width: 100%;
}

.nav .sep {
  margin: 0 16px;
  color: var(--text-tertiary);
  user-select: none;
  font-weight: 300;
}

/* Sections */
.section {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
  padding: 52px 0;
  border-top: 1px solid var(--divider);
}

.section-label {
  grid-column: 1 / 4;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  padding-top: 5px;
}

.section-content {
  grid-column: 4 / 12;
}

/* Bio */
.bio p {
  font-size: 0.9375rem;
  line-height: 1.8;
  max-width: 560px;
  font-weight: 400;
}

.bio p + p {
  margin-top: 20px;
}

/* Links */
.links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.links-list a {
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 16px;
  transition: color 0.2s ease;
}

.links-list a:hover {
  color: var(--accent);
}

.links-list .link-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  min-width: 72px;
  transition: color 0.2s ease;
}

.links-list a:hover .link-label {
  color: var(--accent);
}

/* Experience */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.experience-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: baseline;
}

.experience-role {
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--accent);
}

.experience-company {
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.experience-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  text-align: right;
  letter-spacing: 0.02em;
}

.experience-desc {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 500px;
}

/* Education */
.education-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: baseline;
}

.education-degree {
  font-weight: 500;
  font-size: 0.9375rem;
}

.education-school {
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.education-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Writing */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.blog-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: baseline;
}

.blog-title {
  font-family: 'Newsreader', serif;
  font-optical-sizing: auto;
  font-size: 1.125rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.2s ease;
}

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

.blog-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.blog-excerpt {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 460px;
}

/* Contact */
.contact-email {
  font-family: 'Newsreader', serif;
  font-optical-sizing: auto;
  font-size: 1.625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.contact-email a {
  color: var(--text);
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

.contact-email a::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transition: background 0.2s ease;
}

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

.contact-email a:hover::after {
  background: var(--accent);
}

.contact-note {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: normal;
}

/* Footer */
.footer {
  padding: 52px 0 96px 0;
  border-top: 1px solid var(--divider);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
}

.footer-text {
  grid-column: 1 / -1;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.footer-text span:last-child {
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Projects */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.project-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-name {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.project-name:hover {
  color: var(--accent);
}

.project-tech {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.project-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 500px;
}

/* Blog section on home */
.all-posts-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.all-posts-link:hover {
  color: var(--accent-hover);
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --side-pad: 24px;
    --col-gap: 16px;
  }

  .header {
    padding-top: 40px;
    padding-bottom: 10px;
  }

  .header h1 {
    font-size: 1.875rem;
  }

  .header .subtitle {
    font-size: 0.75rem;
  }

  .nav {
    padding: 20px 0 44px 0;
    font-size: 0.6875rem;
    gap: 6px 0;
  }

  .nav .sep {
    margin: 0 10px;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 36px 0;
  }

  .section-label {
    grid-column: 1;
    padding-bottom: 0;
    font-size: 0.625rem;
  }

  .section-content {
    grid-column: 1;
  }

  .bio p {
    font-size: 0.8125rem;
    line-height: 1.75;
  }

  .links-list {
    gap: 12px;
  }

  .links-list a {
    font-size: 0.8125rem;
  }

  .experience-entry,
  .education-entry,
  .blog-entry {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .experience-role,
  .experience-company,
  .education-degree,
  .education-school {
    font-size: 0.875rem;
  }

  .experience-date,
  .education-date,
  .blog-date {
    text-align: left;
    font-size: 0.625rem;
  }

  .experience-desc {
    font-size: 0.75rem;
    margin-top: 8px;
  }

  .blog-title {
    font-size: 1rem;
  }

  .blog-excerpt {
    font-size: 0.75rem;
  }

  .contact-email {
    font-size: 1.1875rem;
  }

  .contact-note {
    font-size: 0.75rem;
  }

  .footer {
    grid-template-columns: 1fr;
    padding: 36px 0 56px 0;
  }

  .footer-text {
    grid-column: 1;
    flex-direction: column;
    gap: 4px;
    font-size: 0.625rem;
  }
}

@media (max-width: 390px) {
  :root {
    --side-pad: 18px;
  }

  .header h1 {
    font-size: 1.625rem;
  }

  .nav .sep {
    margin: 0 8px;
  }
}

/* Blog index styles */
.blog-index-header {
  font-family: 'Newsreader', serif;
  font-optical-sizing: auto;
  font-size: 2.875rem;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 8px;
}

.blog-index-subtitle {
  font-size: 0.8125rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 48px;
  letter-spacing: 0.01em;
}

.view-all-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.view-all-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.view-all-link:hover {
  color: var(--text);
}

.view-all-link:hover::after {
  width: 100%;
}

/* Blog post styles */
.post-header {
  margin-bottom: 48px;
}

.post-title {
  font-family: 'Newsreader', serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 12px;
}

.post-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.post-content {
  max-width: 640px;
}

.post-content h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 1.125rem;
  margin-top: 40px;
  margin-bottom: 16px;
  color: var(--text);
}

.post-content h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 0.9375rem;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}

.post-content p {
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text);
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-content a:hover {
  color: var(--accent-hover);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85em;
  background: rgba(232, 228, 222, 0.06);
  padding: 2px 6px;
  border-radius: 3px;
}

.post-content pre {
  background: rgba(232, 228, 222, 0.04);
  padding: 20px;
  margin: 24px 0;
  overflow-x: auto;
  border-radius: 3px;
  border: 1px solid rgba(232, 228, 222, 0.06);
}

.post-content pre code {
  background: none !important;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.post-content pre code.hljs {
  background: transparent !important;
  padding: 0;
}

.post-content ul,
.post-content ol {
  margin: 16px 0;
  padding-left: 24px;
  font-size: 0.9375rem;
  line-height: 1.8;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 24px 0;
}

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

.back-link {
  display: inline-block;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--divider);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Post content responsive */
@media (max-width: 768px) {
  .post-title {
    font-size: 1.625rem;
  }

  .blog-index-header {
    font-size: 1.875rem;
  }

  .post-content h2 {
    font-size: 1rem;
  }

  .post-content h3 {
    font-size: 0.875rem;
  }

  .post-content p,
  .post-content ul,
  .post-content ol {
    font-size: 0.8125rem;
  }
}
