*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #fff;
  --text: #1c1c1e;
  --muted: #8a8a8e;
  --border: #e5e5ea;
  --max-w: 700px;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  --radius: 4px;
  --accent: #1c1c1e;
  --danger: #dc2626;
}

body { font-family: var(--serif); font-size: 1.0625rem; background: var(--bg); color: var(--text); line-height: 1.7; min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--muted); }

/* ── Header ── */
.site-header { max-width: var(--max-w); margin: 0 auto; padding: 1.75rem 1.5rem 1.5rem; display: flex; align-items: baseline; gap: 2rem; font-family: var(--sans); }
.site-name { font-size: 1rem; font-weight: 600; color: var(--text); text-decoration: none; flex-shrink: 0; }
.site-name:hover { color: var(--muted); }
.site-nav { display: flex; gap: 1.25rem; }
.site-nav a { font-size: 0.9rem; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-socials { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.site-socials a { color: var(--muted); display: flex; text-decoration: none; }
.site-socials a:hover { color: var(--text); }
.site-socials svg { width: 17px; height: 17px; fill: currentColor; }

/* ── Main ── */
main { max-width: var(--max-w); margin: 0 auto; padding: 2rem 1.5rem 4rem; }

h1 { font-family: var(--sans); font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.3; }
h2 { font-family: var(--sans); font-size: 1.2rem; font-weight: 600; margin: 1.75rem 0 0.6rem; }
p { margin-bottom: 1rem; }

/* ── Prose ── */
.prose { max-width: 100%; }
.prose p { margin-bottom: 1.1rem; }
.prose h2 { margin-top: 2.25rem; }
.prose img, [data-lightbox] { cursor: pointer; }
.prose img { width: calc(100% + 200px); max-width: calc(100% + 200px); margin: 1.75rem -100px; display: block; }
.prose ul, .prose ol { margin: 0.75rem 0 1rem 1.5rem; }
.prose li { margin-bottom: 0.35rem; }
.prose blockquote { border-left: 2px solid var(--border); padding-left: 1.1rem; color: var(--muted); margin: 1.5rem 0; font-style: italic; }
.prose code { font-family: 'Menlo', 'Monaco', monospace; font-size: 0.85em; background: #f5f5f5; padding: 0.15em 0.4em; border-radius: 3px; }
.prose pre { background: #1e1e2e; color: #cdd6f4; padding: 1.25rem; overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius); }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--muted); }

/* ── Feed header ── */
.feed-header { margin-bottom: 2.5rem; }
.feed-header h1 { font-size: 1.75rem; margin-bottom: 0.3rem; }
.feed-header p { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; }

/* ── Feed ── */
.feed { display: flex; flex-direction: column; }
.feed-entry { padding: 1.75rem 0; border-top: 1px solid var(--border); }
.feed-entry:last-child { border-bottom: 1px solid var(--border); }
.feed-meta { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.feed-views { margin-left: auto; }
.feed-title { font-family: var(--sans); font-size: 1.2rem; font-weight: 600; margin-bottom: 0.6rem; line-height: 1.35; }
.feed-title a { color: var(--text); text-decoration: none; }
.feed-title a:hover { text-decoration: underline; }
.feed-cover { width: 100%; margin-bottom: 1rem; display: block; }
a:has(> .feed-cover) { display: block; margin-bottom: 1rem; text-decoration: none; }
a:has(> .feed-cover) .feed-cover { margin-bottom: 0; }
.feed-body { font-size: 0.97rem; }
.feed-excerpt { color: var(--text); font-size: 0.97rem; }
.read-more { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); text-decoration: none; display: inline-block; margin-top: 0.5rem; }
.read-more:hover { color: var(--text); text-decoration: underline; }

/* ── Tags ── */
.tag-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem; font-family: var(--sans); }
.tag-pill { padding: 0.2rem 0.65rem; border: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); text-decoration: none; transition: border-color 0.15s, color 0.15s; }
.tag-pill:hover { color: var(--text); border-color: var(--text); }
.tag-pill.active { color: var(--text); border-color: var(--text); }
.tag-inline { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); background: none; border: none; padding: 0; text-decoration: none; }
.tag-inline:hover { color: var(--text); }

/* ── Pagination ── */
.pagination { display: flex; justify-content: space-between; padding: 2rem 0 1rem; font-family: var(--sans); }
.page-btn { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.page-btn:hover { color: var(--text); }
.page-btn--off { pointer-events: none; }

/* ── Gallery ── */
.gallery-grid-inner { display: flex; flex-wrap: wrap; gap: 3px; }
.gallery-item { overflow: hidden; cursor: pointer; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.35s ease; }
.gallery-item img.gfade { opacity: 1; }
.gallery-item:hover img.gfade { opacity: 1; }
.gallery-item-caption { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); padding: 0.25rem 0; }

/* ── Lightbox ── */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 999; align-items: center; justify-content: center; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 92vw; max-height: 92vh; }
#lightbox-close { position: absolute; top: 1rem; right: 1.5rem; color: white; font-size: 2rem; cursor: pointer; background: none; border: none; font-family: var(--sans); }
#lightbox-prev, #lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 2rem; cursor: pointer; background: none; border: none; padding: 1rem; opacity: 0.6; transition: opacity 0.15s; user-select: none; }
#lightbox-prev:hover, #lightbox-next:hover { opacity: 1; }
#lightbox-prev { left: 1rem; }
#lightbox-next { right: 1rem; }

/* ── Footer ── */
footer { text-align: center; padding: 2rem 1.5rem; color: var(--muted); font-family: var(--sans); font-size: 0.82rem; border-top: 1px solid var(--border); margin-top: 2rem; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* ── Home ── */
.home { padding-top: 5rem; }
.home-name { font-size: 2.25rem; font-weight: 700; font-family: var(--sans); margin-bottom: 0.75rem; }
.home-bio { font-family: var(--sans); font-size: 1rem; color: var(--muted); line-height: 1.7; }
.home-bio a { color: var(--text); }
@media (max-width: 520px) { .home { padding-top: 3rem; } }

/* ── Mobile ── */
@media (max-width: 520px) {
  .site-header { flex-wrap: wrap; gap: 0.75rem; padding: 1.25rem 1rem 1rem; row-gap: 0.5rem; }
  .site-socials { margin-left: 0; }
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.5rem; }
  .feed-title { font-size: 1.1rem; }
  .gallery-title { padding: 1.5rem 1rem 0.75rem !important; font-size: 1.5rem !important; }
  .gallery-cats { padding: 0 1rem 1rem !important; }
  .prose pre { font-size: 0.8rem; padding: 1rem; }
  .prose img { width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }
}
