:root {
  --bg: oklch(0.995 0 0);
  --text: oklch(0.2 0.01 250);
  --text-muted: oklch(0.44 0.01 250);
  --text-light: oklch(0.4 0.01 250);
  --accent: oklch(0.55 0.2 250);
  --tag: oklch(0.55 0.06 250);
  --border: oklch(0.9 0.005 250);
  --border-strong: oklch(0.88 0.005 250);
  --grid-line: oklch(0.9 0.01 250);
  --grid-bg: oklch(0.97 0.004 250);
  --callout-bg: oklch(0.96 0.01 250);
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
}

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

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-strong);
}
.site-header nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
}
.site-title {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.site-nav {
  display: flex;
  gap: 24px;
}
.site-nav a {
  text-decoration: none;
  color: oklch(0.45 0.01 250);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--accent); }

/* Main */
main {
  max-width: 1180px;
  margin: 0 auto;
}

/* Hero */
.hero {
  padding: 56px 36px 30px;
  border-bottom: 1px solid var(--border);
}
.hero-comment {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 18px;
}
.hero h1 {
  font-weight: 700;
  font-size: clamp(30px, 4.8vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin-bottom: 20px;
}
.hero-sub {
  font-size: 16px;
  line-height: 1.6;
  max-width: 58ch;
  color: var(--text-light);
  margin-bottom: 26px;
}

/* Method steps bar */
.method-steps {
  display: flex;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid oklch(0.85 0.005 250);
  width: fit-content;
}
.method-steps span {
  padding: 9px 14px;
  border-right: 1px solid oklch(0.85 0.005 250);
}
.method-steps span:last-child {
  border-right: none;
}
.step-accent {
  color: var(--accent);
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.project-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}
.project-card:hover {
  background: oklch(0.985 0.003 250);
}
.project-card:nth-child(3n) {
  border-right: none;
}
.card-image {
  aspect-ratio: 4/3;
  background-color: var(--grid-bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 18px 18px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  overflow: hidden;
}
.card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fig-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  z-index: 1;
}
.fig-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: oklch(0.46 0.02 250);
  background: var(--bg);
  padding: 3px 6px;
  border: 1px solid var(--border-strong);
  z-index: 1;
}
.card-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-blurb {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.card-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--tag);
  margin-top: 2px;
}

/* Album grid (photos listing) */
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.album-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}
.album-card:hover {
  background: oklch(0.985 0.003 250);
}
.album-card:nth-child(3n) {
  border-right: none;
}
.album-image {
  aspect-ratio: 4/3;
  position: relative;
  padding: 7px 7px 0 0;
}
.album-stack {
  width: 100%;
  height: 100%;
  position: relative;
}
.stack-back {
  position: absolute;
  top: 0;
  right: 0;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border: 1px solid oklch(0.86 0.01 250);
  background: oklch(0.96 0.004 250);
}
.stack-mid {
  position: absolute;
  top: 3px;
  right: 3px;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  border: 1px solid oklch(0.83 0.012 250);
  background: oklch(0.975 0.004 250);
}
.stack-front {
  position: relative;
  width: calc(100% - 7px);
  height: calc(100% - 7px);
  background-color: oklch(0.95 0.012 250);
  background-image:
    linear-gradient(oklch(0.88 0.014 250) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0.88 0.014 250) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid oklch(0.8 0.014 250);
  display: flex;
  align-items: flex-end;
  padding: 10px;
}
.album-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: oklch(0.99 0 0);
  background: var(--accent);
  padding: 3px 7px;
}

/* Album page */
.album {
  padding: 0 36px;
}
.album h1 {
  font-weight: 700;
  font-size: clamp(26px, 3.8vw, 40px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.album-info {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: oklch(0.5 0.01 250);
  margin-bottom: 14px;
}
.album-sep { color: oklch(0.78 0.01 250); }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  padding: 24px 0 40px;
}
.photo-item {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.photo-item img {
  width: 100%;
  border: 1px solid oklch(0.86 0.006 250);
}
.photo-item figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: oklch(0.48 0.01 250);
}

/* Project page */
.project {
  max-width: 820px;
  padding: 0 36px;
}
.project-meta {
  padding: 40px 0 16px;
}
.project-breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.project-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.project h1 {
  font-weight: 700;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.project-tagline {
  font-size: 16px;
  line-height: 1.62;
  color: oklch(0.38 0.01 250);
  max-width: 62ch;
  margin-bottom: 34px;
}
.project-hero-wrap {
  position: relative;
  margin-bottom: 34px;
  border: 1px solid oklch(0.85 0.005 250);
  padding: 18px;
  background-color: var(--grid-bg);
  background-image:
    linear-gradient(oklch(0.93 0.008 250) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0.93 0.008 250) 1px, transparent 1px);
  background-size: 20px 20px;
}
.project-hero {
  width: 100%;
}
.project-content {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text-light);
  max-width: 62ch;
}
.project-content h2,
.project-content h3 {
  color: var(--text);
  margin: 38px 0 12px;
}
.project-content h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
}
.project-content h3 {
  font-size: 20px;
}
.project-content p {
  margin-bottom: 16px;
}
.project-content blockquote {
  margin: 24px 0;
  padding: 18px 22px;
  background: var(--callout-bg);
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 17px;
  color: oklch(0.22 0.01 250);
}
.project-content img {
  border: 1px solid oklch(0.85 0.005 250);
  margin: 24px 0;
}
.project-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--callout-bg);
  padding: 2px 5px;
}
.project-content pre {
  background: oklch(0.16 0.018 245);
  color: oklch(0.9 0.01 245);
  padding: 18px 22px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
.project-content pre code {
  background: none;
  padding: 0;
}
.project-cta {
  margin-top: 34px;
  padding: 18px 22px;
  background: oklch(0.16 0.018 245);
  width: fit-content;
}
.project-cta a {
  color: oklch(0.9 0.01 245);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Generic page */
.page {
  max-width: 700px;
  padding: 48px 36px;
}
.page h1 {
  font-weight: 700;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.page p {
  font-size: 16px;
  line-height: 1.62;
  color: var(--text-light);
  margin-bottom: 16px;
}
.accent { color: var(--accent); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 28px 36px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: oklch(0.5 0.01 250);
  display: flex;
  gap: 12px;
  justify-content: center;
}
.footer-inner a {
  color: oklch(0.5 0.01 250);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-inner a:hover { color: var(--accent); }
.footer-sep { color: oklch(0.78 0.01 250); }

/* Responsive */
@media (max-width: 900px) {
  .project-grid,
  .album-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-card:nth-child(3n) { border-right: 1px solid var(--border); }
  .project-card:nth-child(2n) { border-right: none; }
  .album-card:nth-child(3n) { border-right: 1px solid var(--border); }
  .album-card:nth-child(2n) { border-right: none; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 28px; }
  .project-grid,
  .album-grid {
    grid-template-columns: 1fr;
  }
  .project-card,
  .album-card {
    border-right: none !important;
  }
  .method-steps {
    flex-direction: column;
    width: 100%;
  }
  .method-steps span {
    border-right: none;
    border-bottom: 1px solid oklch(0.85 0.005 250);
  }
  .method-steps span:last-child {
    border-bottom: none;
  }
  .photo-grid {
    grid-template-columns: 1fr;
  }
  .site-header nav {
    padding: 16px 20px;
  }
  .hero { padding: 40px 20px 24px; }
  main { padding: 0; }
  .project, .album, .page { padding: 0 20px; }
}

/* Tables in posts */
.project-content table {
  /* Break out of the 62ch text column so wide tables don't scroll. */
  width: max-content;
  max-width: min(880px, calc(100vw - 48px));
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  display: block;
  overflow-x: auto;
}
.project-content th,
.project-content td {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.project-content th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom-color: var(--border-strong);
}
.project-content td strong { color: var(--text); }

/* 3D model viewer + photo pairs in posts */
.model-figure,
.photo-pair { margin: 24px 0; max-width: none; }
.model-view {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid oklch(0.85 0.005 250);
  background-color: var(--grid-bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 18px 18px;
  cursor: grab;
  touch-action: none;
}
.model-view canvas { display: block; width: 100%; height: 100%; }
.model-hint {
  position: absolute;
  top: 10px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  pointer-events: none;
}
.model-figure figcaption,
.photo-pair figcaption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
}
.photo-pair .photos {
  display: grid;
  grid-template-columns: 4fr 3fr;
  gap: 8px;
}
.photo-pair .photos img { margin: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
  .photo-pair .photos { grid-template-columns: 1fr; }
}

/* Lists in posts */
.project-content ul,
.project-content ol { padding-left: 1.3em; margin-bottom: 16px; }
.project-content li { margin-bottom: 4px; }
