/* Reset & base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
  font-size: 17px;
  line-height: 1.6;
  color: #111;
  background: #fff;
  max-width: 640px;
  margin: 0;
  padding: 2rem 1.5rem;
}

/* Typography */
h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

a {
  color: #111;
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

/* Header */
header {
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 10;
  padding-bottom: 0.5rem;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

header h1 a {
  text-decoration: none;
}

nav {
  margin-top: 0.5rem;
}

nav a {
  margin-right: 1rem;
  font-size: 0.95rem;
}

/* Notes stream */
.notes-stream {
  margin-bottom: 3rem;
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}

/* display:contents so sticky works across posts, not per-post.
   JS handles releasing images after a scroll distance threshold. */
.post-group {
  display: contents;
}

.note-date {
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  color: #666;
  position: sticky;
  top: 3.5rem;
  z-index: 2;
  background: #fff;
  width: fit-content;
  padding: 0.15rem 0.4rem;
  margin-top: 0.15rem;
  margin-bottom: 0;
  margin-left: -1.25rem;
}

/* Sticky scroll — text/dates/images all stick, later layers over earlier.
   Text and dates pin below the header with white bg, fit-content width,
   separated by transparent margin gaps. JS handles image release timing. */
.notes-stream p {
  position: sticky;
  top: 3.5rem;
  z-index: 2;
  background: #fff;
  width: fit-content;
  padding: 0.15rem 0.4rem;
  margin-top: 0.15rem;
  margin-bottom: 0;
  margin-left: 2rem;
}

/* Alternating posts — post-b captions sit flush left */
.post-b p {
  margin-left: 0;
}

.notes-stream p:has(img) {
  top: 5rem;
  z-index: 1;
  width: 100%;
  padding: 0.15rem 0 0;
  margin-top: 0.15rem;
  margin-left: 0;
  line-height: 0;
  background: transparent;
}

/* Alternating image indent */
.post-b p:has(img) {
  margin-left: 1.25rem;
}

.notes-stream img {
  display: block;
  width: 100%;
}

/* Projects list */
.project-item {
  margin-bottom: 1.5rem;
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}

.project-item h2 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.project-item p {
  color: #444;
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Single pages */
article {
  margin-bottom: 3rem;
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}

article header {
  margin-bottom: 0.5rem;
}

article h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

article h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

article h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Lists — reset stripped padding, put it back */
article ul,
article ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

article li {
  margin-bottom: 0.25rem;
}

/* Tables */
article table {
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  width: 100%;
}

article th,
article td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

article th {
  background: #f5f5f5;
  font-weight: 600;
}

/* Figure captions */
article figure {
  margin-bottom: 1rem;
}

article figcaption {
  font-size: 0.9em;
  color: #666;
  font-style: italic;
  margin-top: 0.25rem;
  text-align: center;
}

.meta {
  font-size: 1rem;
  color: #111;
}

/* Code */
code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 0.15em 0.3em;
  border-radius: 3px;
}

pre {
  background: #f5f5f5;
  padding: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  margin-bottom: 1rem;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

/* Writing images - constrained dimensions */
article img {
  max-width: 600px;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Post pages — parallax scroll, full-width images */
article.post p {
  position: sticky;
  top: 3.5rem;
  background: #fff;
  width: fit-content;
  padding: 0.15rem 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

article.post p:has(img) {
  top: 4.5rem;
  width: 100%;
  padding: 0;
  margin-top: 0;
  line-height: 0;
}

article.post img {
  display: block;
  width: 100%;
  max-width: none;
  max-height: none;
}

/* Section headers */
.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 1.5rem;
}

/* Intro & social links */
.intro {
  margin-bottom: 3rem;
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}

.profile-pic {
  width: auto;
  height: 200px;
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.social-links {
  list-style: none;
  margin-top: 1rem;
}

.social-links li {
  margin-bottom: 0.5rem;
}

/* Utility */
hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2rem 0;
}
