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

:root {
  --ink:    #1c1b18;
  --ink2:   #5a5850;
  --ink3:   #8a8880;
  --bg:     #f9f7f2;
  --bg2:    #f1ede4;
  --rule:   rgba(28,27,24,0.12);
  --rule2:  rgba(28,27,24,0.06);
  --serif:  Georgia, 'Times New Roman', serif;
  --sans:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono:   'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --ink:  #ebe9e4;
    --ink2: #c5c2bb;
    --ink3: #9a9790;
    --bg:   #131210;
    --bg2:  #1a1918;
    --rule: rgba(235,233,228,0.12);
    --rule2:rgba(235,233,228,0.06);
  }
}

:root.dark {
  --ink:  #ebe9e4;
  --ink2: #c5c2bb;
  --ink3: #9a9790;
  --bg:   #131210;
  --bg2:  #1a1918;
  --rule: rgba(235,233,228,0.12);
  --rule2:rgba(235,233,228,0.06);
}

/* Theme Toggle */
.theme-toggle {
  color: var(--ink3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.1s;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
html.is-dark .theme-toggle .icon-sun { display: none; }
html.is-dark .theme-toggle .icon-moon { display: block; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  position: relative;
}

/* Subtle grain texture */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.shell {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

nav {
  padding: 36px 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 0.5px solid var(--rule);
}

.nav-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.005em;
}

.nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink3);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

.post-wrap { padding-top: 36px; }

.post-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}

.post-meta {
  font-size: 12px;
  color: var(--ink3);
  display: flex;
  gap: 14px;
  margin-bottom: 28px;
}

.post-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.8;
  color: var(--ink);
  max-width: 600px;
}

.post-body p { margin-bottom: 1.25em; }

/* Drop cap for first paragraph */
.post-body > p:first-of-type::first-letter {
  float: left;
  font-family: var(--serif);
  font-size: 3.5em;
  line-height: 0.8;
  padding-right: 0.08em;
  padding-top: 0.08em;
  color: var(--ink);
  font-weight: 400;
}

.post-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.8em 0 0.6em;
  line-height: 1.3;
}

.post-body h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  margin: 1.8em 0 0.6em;
}

.post-body blockquote {
  border-left: 1.5px solid var(--rule);
  padding-left: 20px;
  margin: 1.4em 0;
  color: var(--ink2);
  font-style: italic;
}

.post-body a {
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 0.5px;
}

.post-body a:hover { text-decoration-color: var(--ink3); }

.post-body ul, .post-body ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.post-body li { margin-bottom: 0.5em; }

.post-body img {
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border-radius: 2px;
}

.post-body strong { font-weight: 500; }

.post-nav {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 0.5px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink3);
}

.post-nav a {
  color: var(--ink3);
  text-decoration: none;
}
.post-nav a:hover { color: var(--ink); }

/* Writing Index */
.page-heading {
  padding-top: 32px;
  padding-bottom: 4px;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  color: var(--ink3);
  border-bottom: 0.5px solid var(--rule);
  margin-bottom: 0;
}

.writing-list { margin-top: 0; }

.writing-year { margin-top: 36px; }

.writing-year-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink3);
  font-weight: 400;
  padding: 16px 0 8px;
  border-bottom: 0.5px solid var(--rule);
}

.writing-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 0.5px solid var(--rule2);
  gap: 16px;
  text-decoration: none;
}

.writing-row:hover .writing-row-title { color: var(--ink3); }

.writing-row-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.25;
  transition: color 0.1s;
  flex: 1;
}

.writing-row-date {
  font-size: 11px;
  color: var(--ink3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* INTRO */
.intro { padding: 40px 0 0; }

.intro-graphic {
  display: block;
  color: var(--ink);
  margin-bottom: 20px;
}

.intro-banner {
  display: block;
  width: 52px;
  height: auto;
  margin-bottom: 16px;
  opacity: 0.8;
}

.intro-body {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.75;
  color: var(--ink);
  max-width: 560px;
}

.intro-body a {
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 0.5px;
}

.intro-body a:hover { text-decoration-color: var(--ink3); }

/* LANDING SECTIONS */
.landing-sections {
  margin-top: 44px;
  border-top: 0.5px solid var(--rule);
}

.landing-section {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 28px;
  padding: 24px 0;
  border-bottom: 0.5px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.ls-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink3);
  text-transform: lowercase;
  padding-top: 2px;
}

.ls-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.ls-item:hover {
  opacity: 0.6;
}

.ls-item-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
  flex: 1;
  padding-right: 16px;
}

.ls-item-date {
  font-size: 11px;
  color: var(--ink3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.ls-more {
  font-size: 11px;
  color: var(--ink3);
  margin-top: 8px;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: block;
}

.ls-more:hover {
  color: var(--ink);
}

/* Landing Photo Grid (macwright style) */
.landing-section-photos {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 28px;
  padding: 24px 0;
  border-bottom: 0.5px solid var(--rule);
}

.ls-photo-wrap {
  display: block;
}

.ls-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ls-photo-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ls-photo-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  transition: opacity 0.15s;
}

.ls-photo-item:hover img {
  opacity: 0.8;
}

/* NOW BLOCK */
.now-block {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 0.5px solid var(--rule);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 28px;
}

.now-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink3);
  text-transform: lowercase;
  padding-top: 4px;
}

.now-date {
  font-size: 11px;
  color: var(--ink3);
  margin-bottom: 10px;
}

.now-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink2);
}

/* TALKS */
.talks-wrap { padding-top: 8px; }

.talk-item {
  padding: 20px 0;
  border-bottom: 0.5px solid var(--rule2);
}

.talk-venue {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink3);
  text-transform: lowercase;
  margin-bottom: 5px;
}

.talk-title {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 5px;
}

.talk-desc {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.5;
}

.talk-date {
  font-size: 11px;
  color: var(--ink3);
  margin-top: 8px;
}

/* PHOTOS - Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding-top: 24px;
}

.photo-grid-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

.photo-thumb {
  aspect-ratio: 4/3;
  background-size: cover;
  background-position: center;
  background-color: var(--bg2);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.photo-thumb-placeholder {
  color: var(--ink3);
}

.photo-grid-item:hover .photo-thumb {
  opacity: 0.85;
}

.photo-grid-meta {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.photo-grid-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.3;
}

.photo-grid-location {
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: 0.02em;
}

/* PHOTOS - Single */
.photo-single {
  padding-top: 24px;
}

.photo-single-image {
  position: relative;
  background: var(--bg2);
  border-radius: 2px;
  margin-bottom: 20px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-single-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.photo-single-placeholder {
  position: absolute;
  color: var(--ink3);
}

.photo-single-image img:not([src=""]) + .photo-single-placeholder {
  display: none;
}

.photo-single-meta {
  margin-bottom: 16px;
}

.photo-single-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.2;
}

.photo-single-details {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--ink3);
}

.photo-single-location {
  font-weight: 500;
}

.photo-single-description {
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  color: var(--ink2);
  line-height: 1.6;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 0.5px solid var(--rule);
}

.photo-single-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
}

.photo-single-body p {
  margin-bottom: 1.2em;
}

.photo-nav {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 0.5px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.photo-nav a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.photo-nav-prev a { text-align: left; }
.photo-nav-next a { text-align: right; }

.photo-nav-label {
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}

.photo-nav-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  transition: color 0.1s;
}

.photo-nav a:hover .photo-nav-title {
  color: var(--ink3);
}

.photo-back {
  margin-top: 24px;
  padding-top: 16px;
}

.photo-back a {
  font-size: 12px;
  color: var(--ink3);
  text-decoration: none;
}

.photo-back a:hover {
  color: var(--ink);
}

/* READING */
.reading-wrap { padding-top: 8px; }

.reading-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink3);
  margin: 32px 0 0;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--rule);
  display: block;
}

.reading-row {
  display: block;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--rule2);
}

.reading-title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.3;
}

.reading-author {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 3px;
}

.reading-status {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink3);
  text-align: right;
  padding-top: 3px;
}

/* ABOUT */
.about-wrap { padding-top: 32px; }

.about-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
  color: var(--ink);
}

.about-body p { margin-bottom: 1.3em; }

.about-body a {
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 0.5px;
}

.about-body a:hover { text-decoration-color: var(--ink3); }

.about-links {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 0.5px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-links a {
  font-size: 13px;
  color: var(--ink3);
  text-decoration: none;
}

.about-links a:hover { color: var(--ink); }

/* Tablet */
@media (max-width: 768px) {
  .ls-photo-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Large mobile */
@media (max-width: 640px) {
  .ls-photo-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .ls-photo-item:nth-child(3),
  .ls-photo-item:nth-child(4) { display: none; }
  .photo-grid { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 600px) {
  .shell { padding: 0 16px 60px; }

  /* Navigation */
  nav {
    padding: 20px 0 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-name { font-size: 16px; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 11px; }
  .theme-toggle { padding: 6px; }

  /* Intro */
  .intro { padding: 24px 0 0; }
  .intro-body { font-size: 17px; line-height: 1.6; }
  .intro-banner { width: 36px; margin-bottom: 12px; }

  /* Posts */
  .post-wrap { padding-top: 28px; }
  .post-title { font-size: 24px; margin-bottom: 8px; }
  .post-body { font-size: 17px; line-height: 1.7; }
  .post-body h2 { font-size: 20px; }
  .post-body h3 { font-size: 18px; }
  .post-meta { flex-wrap: wrap; gap: 8px; }
  .post-body > p:first-of-type::first-letter { font-size: 3em; }

  /* Landing sections */
  .landing-sections { margin-top: 28px; }
  .landing-section {
    grid-template-columns: 1fr;
    gap: 10px 0;
    padding: 16px 0;
  }
  .landing-section-photos {
    grid-template-columns: 1fr;
    gap: 10px 0;
    padding: 16px 0;
  }
  .ls-label {
    padding-top: 0;
    margin-bottom: 4px;
  }
  .ls-item {
    padding: 6px 0;
  }
  .ls-item-title {
    font-size: 15px;
    padding-right: 12px;
  }
  .ls-item-date { font-size: 10px; }
  .ls-more { margin-top: 10px; }
  .ls-photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .ls-photo-item:nth-child(3),
  .ls-photo-item:nth-child(4) { display: block; }

  /* Now block */
  .now-block {
    margin-top: 24px;
    padding-top: 16px;
    grid-template-columns: 1fr;
    gap: 8px 0;
  }
  .now-text { font-size: 15px; }

  /* Page heading */
  .page-heading { padding-top: 20px; font-size: 12px; }

  /* Writing list */
  .writing-year { margin-top: 28px; }
  .writing-year-label { padding: 12px 0 6px; }
  .writing-row {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding: 10px 0;
  }
  .writing-row-title { font-size: 15px; }
  .writing-row-date { font-size: 10px; }

  /* Photos */
  .photo-grid { gap: 12px; padding-top: 20px; }
  .photo-single { padding-top: 20px; }
  .photo-single-title { font-size: 20px; }
  .photo-single-details { gap: 12px; font-size: 11px; }
  .photo-single-description { font-size: 15px; }
  .photo-single-body { font-size: 15px; }
  .photo-nav { grid-template-columns: 1fr; gap: 16px; }
  .photo-nav-next a { text-align: left; }
  .photo-nav-title { font-size: 14px; }
  .photo-grid-title { font-size: 14px; }
  .photo-grid-location { font-size: 10px; }

  /* Reading */
  .reading-wrap { padding-top: 4px; }
  .reading-section-label { margin: 24px 0 0; }
  .reading-row { padding: 10px 0; }
  .reading-title { font-size: 15px; }
  .reading-author { font-size: 11px; }

  /* Footer */
  .footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 48px;
  }
  .colophon { text-align: left; }

  /* About */
  .about-wrap { padding-top: 24px; }
  .about-body { font-size: 17px; }
}

/* Small mobile */
@media (max-width: 380px) {
  .shell { padding: 0 14px 50px; }
  nav { gap: 10px; }
  .nav-links { gap: 10px; }
  .nav-links a { font-size: 10px; }
  .intro-body { font-size: 16px; }
  .ls-item-title { font-size: 14px; }
  .post-title { font-size: 22px; }
  .post-body { font-size: 16px; }
  .writing-row-title { font-size: 14px; }
  .reading-title { font-size: 14px; }
  .photo-single-title { font-size: 18px; }
}

/* Footer */
.footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 0.5px solid var(--rule);
  display: flex;
  gap: 24px;
  font-size: 12px;
}

.footer a {
  color: var(--ink3);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--ink);
}

/* Colophon */
.colophon {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 0.5px solid var(--rule);
  font-size: 12px;
  color: var(--ink3);
  line-height: 1.7;
  font-style: italic;
}
