@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap");

/* ─── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --font-serif: "DM Serif Display", serif;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --color-ink: #2a2118;
  --color-text: #3d3128;
  --color-muted: #6b5f52;
  --color-faint: #8a7d6e;
  --color-bg: #f7f3ed;
  --color-surface: #ede9e3;
  --color-border: #e0d8ce;
  --color-accent: #10a2f5;

  --shadow-sm:
    0 1px 2px rgba(42, 33, 24, 0.06), 0 4px 10px rgba(42, 33, 24, 0.08),
    0 12px 28px rgba(42, 33, 24, 0.08);
  --shadow-contain: drop-shadow(0 2px 6px rgba(42, 33, 24, 0.12))
    drop-shadow(0 8px 20px rgba(42, 33, 24, 0.1));

  --radius-sm: 3px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
}

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

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 400;
}

html {
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-bg);
  padding: 40px 20px;
}

.container {
  max-width: 700px;
  margin: 0 auto;
}
.container-wide {
  max-width: 1100px;
  margin: 0 auto;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: 48px;
}

/* ─── Navigation ──────────────────────────────────────────────────────────── */
nav {
  text-align: center;
  margin-bottom: 60px;
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

nav a {
  color: var(--color-ink);
  text-decoration: none;
  font-size: 16px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

nav a:hover {
  border-bottom: 2px solid var(--color-accent);
}

/* ─── Home header ─────────────────────────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 60px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-pic {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  margin: 0 auto 30px;
  overflow: hidden;
}

.profile-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

header h1 {
  font-size: 48px;
  margin-bottom: 15px;
}

header p {
  font-size: 20px;
  color: var(--color-muted);
  margin-bottom: 30px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.social-links a {
  color: var(--color-ink);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid #eb4888;
}

.social-links a:nth-child(2) {
  border-bottom-color: #24d05a;
}
.social-links a:nth-child(3) {
  border-bottom-color: var(--color-accent);
}
.social-links a:nth-child(4) {
  border-bottom-color: #ff6f21;
}
.social-links a:hover {
  opacity: 0.7;
}

/* ─── Inline stickers ─────────────────────────────────────────────────────── */
.sticker {
  display: inline;
  height: 1.2em;
  width: auto;
  vertical-align: -0.2em;
  margin: 0 0.05em;
}

/* ─── Typography ──────────────────────────────────────────────────────────── */
section {
  margin-bottom: 80px;
}

h2 {
  font-size: 32px;
  margin-bottom: 30px;
}

h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
}

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

a:hover {
  text-decoration: underline;
}

/* ─── Tags ────────────────────────────────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  font-size: 11px;
  color: var(--color-muted);
  background: var(--color-surface);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* ─── Blog posts ──────────────────────────────────────────────────────────── */
.post {
  margin-bottom: 40px;
}

.post h3 a {
  color: var(--color-ink);
}

.post-date {
  color: var(--color-faint);
  font-size: 14px;
  margin-bottom: 8px;
}

.post p {
  color: var(--color-muted);
  line-height: 1.7;
}

/* ─── Content pages ───────────────────────────────────────────────────────── */
.content h2,
.content h3,
.content h4,
.content h5 {
  scroll-margin-top: 15vh;
  position: relative;
}

.heading-anchor {
  color: inherit;
  text-decoration: none;
}

.heading-anchor:hover {
  text-decoration: none;
  color: inherit;
}

.heading-anchor:hover::before {
  opacity: 1;
}

.heading-anchor::before {
  content: "#";
  position: absolute;
  left: -24px;
  color: var(--color-border);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}

.heading-anchor:hover::before {
  color: var(--color-accent);
}

@keyframes heading-flash {
  0% {
    background: var(--color-surface);
  }
  100% {
    background: transparent;
  }
}

.heading-highlight {
  animation: heading-flash 1.5s ease-out;
}

.content h2 {
  font-size: 28px;
  margin-top: 48px;
  margin-bottom: 16px;
}

.content h3 {
  font-size: 22px;
  margin-top: 36px;
  margin-bottom: 12px;
}

.content h4 {
  font-size: 17px;
  font-family: var(--font-sans);
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
}

.content h5 {
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-top: 24px;
  margin-bottom: 8px;
}

.content p {
  margin-bottom: 20px;
  line-height: 1.7;
  color: var(--color-muted);
}

.content ul,
.content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.content li {
  margin-bottom: 8px;
  line-height: 1.7;
  color: var(--color-muted);
}

.content blockquote {
  border-left: 3px solid var(--color-border);
  margin: 20px 0;
  padding: 4px 0 4px 20px;
  color: var(--color-muted);
}

.content blockquote p {
  margin: 0;
}

.content strong {
  color: var(--color-ink);
}

.content code {
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: "Courier New", monospace;
  font-size: 14px;
}

.content pre {
  background: var(--color-surface);
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 20px 0;
}

.content pre code {
  background: none;
  padding: 0;
}

/* ─── Project detail pages ────────────────────────────────────────────────── */
body.project-page {
  padding: 0;
}
body.project-page.no-hero {
  padding: 40px 20px 0;
}

.top-nav {
  padding: 36px 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  margin-bottom: 0;
}

.top-nav a {
  color: var(--color-ink);
  text-decoration: none;
  font-size: 15px;
  border-bottom: none;
}
.top-nav a:hover {
  border-bottom: none;
  text-decoration: none;
  color: #000;
}
.top-nav .wordmark {
  font-weight: 700;
  font-size: 17px;
}
.top-nav .links {
  display: flex;
  gap: 28px;
}

.hero {
  width: 100%;
  height: 60vh;
  overflow: hidden;
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-header {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 40px 20px;
}

.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--color-faint);
  text-decoration: none;
  margin-bottom: 32px;
  letter-spacing: 0.04em;
}
.back-link:hover {
  color: var(--color-ink);
  text-decoration: none;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-faint);
  margin-bottom: 12px;
}

.project-header h1 {
  font-size: 48px;
  line-height: 1.08;
  margin-bottom: 24px;
}

/* ─── Project links ───────────────────────────────────────────────────────── */
.links-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.link-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.link-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-faint);
  min-width: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.link-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  color: var(--color-faint);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
  cursor: default;
  position: relative;
  flex-shrink: 0;
}

.link-info::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--color-ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  width: 220px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
.link-info:hover::after {
  opacity: 1;
}

.project-link {
  font-size: 14px;
  color: var(--color-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--color-ink);
  padding-bottom: 1px;
  transition: opacity 0.15s;
}
.project-link:hover {
  opacity: 0.5;
  text-decoration: none;
}

.project-link.private {
  color: var(--color-faint);
  border-bottom-color: var(--color-border);
}
.project-link.private::after {
  content: " (private)";
  font-size: 12px;
}

/* ─── Project body ────────────────────────────────────────────────────────── */
.project-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 40px 80px;
}
.project-body p {
  font-size: 17px;
  color: var(--color-text);
  line-height: 1.75;
  margin-bottom: 24px;
}

.project-body ul,
.project-body ol {
  margin: 16px 0;
  padding-left: 24px;
  font-size: 17px;
  color: var(--color-text);
  line-height: 1.75;
}

.project-body li {
  margin-bottom: 6px;
}

.project-body figcaption {
  font-size: 12px;
  color: var(--color-faint);
  margin-top: 6px;
  line-height: 1.4;
  text-align: center;
  font-style: italic;
}

.photo {
  margin: 32px 0;
}
.photo img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
.photo figcaption {
  margin-top: 8px;
  text-align: center;
}
.photo .photo-caption {
  font-size: 13px;
  color: var(--color-muted);
  font-style: normal;
}
.photo .photo-caption strong {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}
.photo .photo-caption p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.photo .photo-credit {
  margin-top: 4px;
  font-size: 11px;
  color: var(--color-faint);
  font-style: italic;
}
.photo-wide {
  margin-left: calc(-1 * var(--photo-bleed, 80px));
  margin-right: calc(-1 * var(--photo-bleed, 80px));
}
.photo-right {
  float: right;
  max-width: 320px;
  margin: 4px 0 16px 24px;
}

.stub {
  margin: 24px 0;
  padding: 14px 18px;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  background: rgba(255, 200, 0, 0.05);
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}
.stub::before {
  content: "🚧 ";
}
.stub::after {
  content: " 🚧";
}

.project-body blockquote {
  border-left: 3px solid var(--color-border);
  margin: 24px 0;
  padding: 8px 0 8px 24px;
}

.project-body blockquote p {
  font-size: 17px;
  color: var(--color-muted);
  margin-bottom: 0;
}

.project-section {
  margin-bottom: 56px;
}
.project-section:last-of-type {
  margin-bottom: 0;
}
.project-section h2 {
  font-size: 28px;
  margin-bottom: 18px;
}

.image-group {
  margin: 48px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.image-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 48px 0;
}

.image-row + .image-row {
  margin-top: -44px;
}
.image-group .image-row {
  margin: 0;
}
.image-row img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}
/* MDX wraps images in <p> — make them invisible to the grid */
.image-row p {
  display: contents;
  margin: 0;
}

.image-full {
  margin: 48px 0;
}
.image-full img {
  width: 100%;
  display: block;
}
.image-full.portrait {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.image-full p {
  margin: 0;
}

.image-float-right {
  float: right;
  width: 45%;
  margin: 4px 0 24px 32px;
}
.image-float-right img {
  width: 100%;
  display: block;
}
.image-float-right p {
  margin: 0;
}
.image-float-right + * {
  margin-top: 0;
}
.project-section:has(.image-float-right)::after {
  content: "";
  display: table;
  clear: both;
}

.video-embed {
  margin: 40px 0 24px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ─── Last updated ────────────────────────────────────────────────────────── */
.last-updated {
  margin-top: 48px;
  font-size: 13px;
  color: var(--color-faint);
}

/* ─── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 100px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border);
  color: var(--color-faint);
  font-size: 14px;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .top-nav {
    padding: 24px;
  }
  .project-header,
  .project-body {
    padding-left: 24px;
    padding-right: 24px;
  }
  .project-header h1 {
    font-size: 36px;
  }
  .image-row {
    grid-template-columns: 1fr;
  }
  .image-full.portrait {
    max-width: 320px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 20px 15px;
  }
  header h1 {
    font-size: 36px;
  }
  header p {
    font-size: 18px;
  }
  h2 {
    font-size: 28px;
  }
  nav ul {
    gap: 20px;
  }
}

/* ─── TOC (on this page, shared by blog + project) ───────────────────────── */
.toc {
  position: fixed;
  top: 100px;
  left: calc(50% + 420px);
  width: 200px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  text-align: left;
  transition: opacity 0.2s ease;
}

.toc.toc-hidden {
  opacity: 0;
  pointer-events: none;
}

.toc .toc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 10px;
}

.toc nav {
  text-align: left;
  margin: 0;
}

.toc nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0;
}

.toc nav li {
  border-left: 2px solid var(--color-border);
  padding: 3px 0 3px 12px;
  margin: 0;
  line-height: 1.3;
}

.toc nav li.active {
  border-left-color: var(--color-ink);
}

.toc nav li a {
  font-size: 11px;
  color: var(--color-faint);
  text-decoration: none;
  transition: color 0.15s;
  border: none;
}

.toc nav li a:hover {
  color: var(--color-ink);
  text-decoration: none;
  border: none;
}

.toc nav li.active a {
  color: var(--color-ink);
}

.toc nav li.toc-depth-3 {
  padding-left: 24px;
}

@media (max-width: 1100px) {
  .toc {
    display: none;
  }
}
