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

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

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.7;
  color: #2c3e50;
  background-color: #fafafa;
}

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

/* Navigation */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 1rem 0;
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: #e74c3c;
  transition: width 0.1s ease-out;
}

nav .container {
  display: flex;
  gap: 2rem;
  padding-top: 0;
  padding-bottom: 0;
}

.breadcrumbs {
  font-size: 0.9rem;
}

.breadcrumbs a {
  color: #e74c3c;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.breadcrumbs a:hover {
  color: #c0392b;
}

.breadcrumbs .separator {
  color: #999;
  margin: 0 0.5rem;
}

.breadcrumbs .current {
  color: #666;
}

/* Main content */
main {
  background: #fff;
  min-height: calc(100vh - 60px);
}

main .container {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 900;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.post-date {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.medium-note {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin-bottom: 2rem;
}

article header {
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1.25rem;
}

a {
  color: #e74c3c;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

a:hover {
  color: #c0392b;
}

/* Lists */
ul,
ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Code */
code {
  font-family: "Fira Code", "Consolas", monospace;
  font-size: 0.875rem;
  background: #f4f4f4;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre {
  background: #1a1a2e;
  color: #f4f4f4;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: inherit;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid #e74c3c;
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: #555;
  font-style: italic;
}

/* Images - breakout style (wider than text column) */
img {
  display: block;
  max-width: min(100vw - 3rem, 900px);
  width: auto;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem auto;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

/* Figures with captions */
figure {
  margin: 1.5rem 0;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(100vw - 3rem, 900px);
  width: fit-content;
}

figure img {
  position: static;
  left: auto;
  transform: none;
  margin: 0;
}

figcaption {
  text-align: center;
  font-size: 0.7rem;
  color: #666;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Clickable image links */
a.image-link {
  display: block;
  text-decoration: none;
  border: none;
  cursor: zoom-in;
}

a.image-link img {
  transition: opacity 0.2s;
}

a.image-link:hover img {
  opacity: 0.9;
}

/* When figure is wrapped in a link, the link handles the breakout positioning */
a.image-link:has(figure) {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  max-width: min(100vw - 3rem, 900px);
}

a.image-link figure {
  position: static;
  left: auto;
  transform: none;
  margin: 1.5rem 0;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2.5rem 0;
}

/* Blog index */
.blog-index h1 {
  margin-bottom: 0.5rem;
}

.blog-subtitle {
  color: #666;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.blog-stats {
  color: #888;
  font-size: 0.8rem;
  margin-bottom: 2.5rem;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

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

.post-list a {
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  color: #1a1a2e;
}

.post-list a:hover {
  color: #e74c3c;
}

.post-list .post-description {
  color: #555;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.post-list .post-date {
  font-size: 0.85rem;
  margin: 0;
}

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

bold {
  font-weight: bold;
}
