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

/* === Custom Properties === */
:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --site-width: 720px;
}

[data-theme="dark"] {
  --bg: #161616;
  --bg-secondary: #1e1e1e;
  --text: #e5e5e5;
  --text-muted: #888888;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --border: #2a2a2a;
}

/* === Base === */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.2s, color 0.2s;
}

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

img { max-width: 100%; height: auto; display: block; border-radius: 4px; }

code, pre {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 15px;
}

pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

code { background: var(--bg-secondary); padding: 0.15em 0.35em; border-radius: 3px; }
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1rem 0;
}

h1, h2, h3, h4 {
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 700;
  line-height: 1.3;
}

/* === Layout === */
.site-wrapper {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === Skip Link === */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* === Header === */
.site-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 0 0.5rem;
}

.site-header .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.site-header h1 {
  font-size: 1.25rem;
}

.site-header h1 a {
  color: var(--text);
  text-decoration: none;
}

/* === Navigation === */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-secondary);
  text-decoration: none;
}

.dark-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* === Posts === */
.post {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post:last-child { border-bottom: none; }

.post-date {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.post-date a { color: var(--text-muted); }
.post-date a:hover { color: var(--accent); }

.post-content { margin-top: 0.5rem; }
.post-content p { margin-bottom: 1rem; }
.post-content p:last-child { margin-bottom: 0; }

.post-title {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

/* === Long-form content === */
.post-content h2 { font-size: 1.5rem; margin: 2.25rem 0 0.75rem; line-height: 1.3; }
.post-content h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; line-height: 1.35; }
.post-content h4 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.post-content h2:first-child,
.post-content h3:first-child { margin-top: 0; }

.post-content ul,
.post-content ol { padding-left: 1.5rem; margin: 0 0 1.25rem; }
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: 0.4rem; }
.post-content li::marker { color: var(--text-muted); }

.post-content figure { margin: 1.75rem 0; }
.post-content figure img { border-radius: 6px; }
.post-content figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-muted);
}
.post-content blockquote p { margin-bottom: 0.5rem; }
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content strong { font-weight: 600; color: var(--text); }

.post-content a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

.post-single .post-title { font-size: 1.85rem; line-height: 1.25; margin-bottom: 0.5rem; }

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

.pagination a { color: var(--text-muted); }
.pagination a:hover { color: var(--accent); }

/* === Archive === */
.archive-month {
  margin-top: 2rem;
}

.archive-month h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.archive-entry {
  padding: 0.4rem 0;
  font-size: 0.95rem;
  display: flex;
  gap: 0.5rem;
}

.archive-entry .date {
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
}

.archive-entry .excerpt {
  color: var(--text);
}

/* === Photos Grid === */
.photos-month {
  margin-top: 2rem;
}

.photos-month h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.photos-grid a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
}

.photos-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  transition: transform 0.2s;
}

.photos-grid a:hover img { transform: scale(1.05); }

/* === Photos Load More === */
.photos-load-more {
  text-align: center;
  margin-top: 2rem;
}

.photos-load-more a {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-block;
}

.photos-load-more a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* === Feeds Page === */
.feeds-list {
  list-style: none;
  margin-top: 1rem;
}

.feeds-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feeds-list .feed-icon { width: 24px; height: 24px; flex-shrink: 0; }
.feeds-list .feed-icon svg { width: 100%; height: 100%; fill: var(--accent); }

.feeds-list .feed-info .feed-name { font-weight: 600; }
.feeds-list .feed-info .feed-desc { font-size: 0.85rem; color: var(--text-muted); }

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

.social-icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.75rem 0;
}

.social-icons a {
  display: block;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

.social-icons a:hover { color: var(--accent); }
.social-icons svg { width: 100%; height: 100%; fill: currentColor; }

.subscribe-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === 404 === */
.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found h1 { font-size: 2rem; margin-bottom: 1rem; }

/* === Comments / Webmentions === */
.webmentions { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.webmentions h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.comment-list { list-style: none; }
.comment-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

/* === Responsive === */
@media (max-width: 480px) {
  body { font-size: 16px; }
  .site-header .avatar { width: 40px; height: 40px; }
  .photos-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* === Ghost port additions === */
.menu { list-style: none; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.kg-card, .kg-image-card { margin: 1.75rem 0; }
.kg-image { border-radius: 6px; max-width: 100%; height: auto; }
#archive-list .archive-entry, #photos-list .photo-entry { }

/* Koenig editor width classes (Ghost theme-check requirement) */
.kg-width-wide { position: relative; width: 85vw; max-width: 1040px; margin-left: calc(50% - 50vw + (100vw - 85vw) / 2); }
.kg-width-full { position: relative; width: 100vw; margin-left: calc(50% - 50vw); }
.kg-width-wide img, .kg-width-full img { max-width: 100%; }
