:root {
  --bg: #fbfaf8;
  --fg: #1a1a1a;
  --fg-muted: #6b6b6b;
  --border: #e4e1db;
  --accent: #a4522f;
  --card-bg: #ffffff;
  --max-width: 46rem;
  --wide-width: 64rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --fg: #ece9e2;
    --fg-muted: #9c988e;
    --border: #2c2a24;
    --accent: #e08a5f;
    --card-bg: #1c1b16;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.site-nav a:hover {
  color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.5rem 0;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* Main */
main.wrap {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h2 {
  font-size: 1.25rem;
  margin: 2.5rem 0 1rem;
}

/* Hero */
.hero {
  max-width: var(--max-width);
  margin-bottom: 2rem;
}
.hero h1 {
  font-size: 2.5rem;
}
.hero p {
  color: var(--fg-muted);
  font-size: 1.1rem;
}

/* Section cards (home) */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
  margin-top: 3rem;
}
.card {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 0.5rem;
  padding: 1.5rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Item list (writing index, recent) */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.item-list li {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.item-list a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}
.item-list .item-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.item-list .item-title {
  font-weight: 600;
  font-size: 1.05rem;
}
.item-list time {
  margin-left: auto;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
.item-excerpt {
  color: var(--fg-muted);
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.gallery-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--card-bg);
  transition: border-color 0.15s ease;
}
.gallery-tile:hover {
  border-color: var(--accent);
}
.gallery-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.gallery-tile-title {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Single piece */
.piece-header {
  max-width: var(--max-width);
  margin-bottom: 1.5rem;
}
.piece-header time {
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.piece-figure {
  margin: 0 0 2rem;
}
.piece-figure img {
  max-width: 100%;
  border-radius: 0.5rem;
  display: block;
}
.piece-figure figcaption {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.prose {
  max-width: var(--max-width);
  font-size: 1.05rem;
}
.prose p { margin: 1.1em 0; }
.prose img { max-width: 100%; border-radius: 0.5rem; }
.prose.intro {
  color: var(--fg-muted);
  margin-bottom: 0;
}
