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

/* ── Variables ── */
:root {
  --bg: oklch(97% 0.018 75);
  --surface: oklch(94% 0.022 75);
  --ink: oklch(18% 0.02 60);
  --ink-muted: oklch(50% 0.015 65);
  --accent: oklch(55% 0.16 35);
  --accent-light: oklch(92% 0.06 60);
  --rule: oklch(85% 0.025 75);
  --ff-display: 'Playfair Display', Georgia, serif;
  --ff-body: 'DM Sans', system-ui, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

/* ── Layout ── */
.site-wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--rule);
}

.site-nav__wordmark {
  font-family: var(--ff-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.site-nav__links a {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.site-nav__links a:hover { color: var(--accent); }

/* ── Hero ── */
.hero {
  padding: 72px 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 28px;
  border: 3px solid var(--rule);
  background: var(--surface);
  flex-shrink: 0;
}

.hero__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 2rem;
  color: var(--ink-muted);
  background: var(--surface);
}

.hero__name {
  font-family: var(--ff-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--ink);
}

.hero__bio {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-muted);
  max-width: 480px;
  margin-bottom: 32px;
}

.hero__bio em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

.hero__socials {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.social-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ink-muted);
  text-decoration: none;
  background: transparent;
  transition: all 0.18s;
}

.social-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.social-pill svg { flex-shrink: 0; }

/* ── Sections ── */
.section {
  padding: 56px 0;
  border-top: 1px solid var(--rule);
}

.section__label {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 32px;
}

/* ── Post list ── */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.post-item:first-child { border-top: 1px solid var(--rule); }
.post-item:hover { opacity: 0.7; }
.post-item:hover .post-item__title { color: var(--accent); }

.post-item__title {
  font-family: var(--ff-display);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  transition: color 0.18s;
}

.post-item__excerpt {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.post-item__date {
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: right;
}

.see-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  transition: gap 0.2s;
}

.see-all:hover { gap: 10px; }

/* ── Link items ── */
.links-grid {
  display: flex;
  flex-direction: column;
}

.link-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.link-item:first-child { border-top: 1px solid var(--rule); }
.link-item:hover { opacity: 0.7; }

.link-item__favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--surface);
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.link-item__favicon img { width: 100%; height: 100%; object-fit: cover; }

.link-item__title {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
}

.link-item__desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-top: 2px;
  line-height: 1.5;
}

/* ── Footer ── */
.site-footer {
  padding: 40px 0 60px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer__copy {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.site-footer__ghost {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.site-footer__ghost:hover { opacity: 1; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
}

.fade-up:nth-child(1) { animation-delay: 0.05s; }
.fade-up:nth-child(2) { animation-delay: 0.12s; }
.fade-up:nth-child(3) { animation-delay: 0.19s; }
.fade-up:nth-child(4) { animation-delay: 0.26s; }
.fade-up:nth-child(5) { animation-delay: 0.33s; }
.fade-up:nth-child(n+6) { animation-delay: 0.4s; }

/* ── Tag chip ── */
.tag {
  display: inline-block;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--accent-light);
  color: var(--accent);
  margin-right: 6px;
  text-decoration: none;
  white-space: nowrap;
}

/* ── Post page ── */
.post-header {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 48px;
}

.post-title {
  font-family: var(--ff-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 16px;
  margin-bottom: 20px;
}

.post-meta {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post-meta__sep { opacity: 0.4; }

.post-feature {
  margin: 0 0 48px;
}

.post-feature img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

.post-feature figcaption {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}

/* ── Article content ── */
.gh-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  margin-bottom: 64px;
}

.gh-content > * + * { margin-top: 1.5em; }

.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4,
.gh-content h5,
.gh-content h6 {
  font-family: var(--ff-display);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.gh-content h2 { font-size: 1.5rem; }
.gh-content h3 { font-size: 1.25rem; }
.gh-content h4 { font-size: 1.1rem; }

.gh-content p { margin: 0; }

.gh-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.gh-content a:hover { opacity: 0.8; }

.gh-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0 0 0 24px;
  margin: 0;
  font-family: var(--ff-display);
  font-style: italic;
  font-size: 1.125rem;
  color: var(--ink-muted);
}

.gh-content blockquote p { font-size: inherit; }

.gh-content code {
  font-family: 'SFMono-Regular', 'Menlo', 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
}

.gh-content pre {
  background: var(--ink);
  color: var(--bg);
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
}

.gh-content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
  color: inherit;
  border-radius: 0;
}

.gh-content ul,
.gh-content ol {
  padding-left: 1.5em;
  margin: 0;
}

.gh-content li + li { margin-top: 0.4em; }

.gh-content hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.gh-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.gh-content figure { margin: 0; }

.gh-content figcaption {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}

.gh-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.gh-content th,
.gh-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.gh-content th {
  font-weight: 500;
  font-family: var(--ff-display);
}

/* Ghost Koenig card styles */
.kg-image-card img { border-radius: 8px; }

.kg-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.kg-bookmark-card {
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}

.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.kg-bookmark-content {
  flex: 1;
  padding: 16px;
}

.kg-bookmark-title {
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}

.kg-bookmark-description {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.kg-bookmark-thumbnail {
  width: 140px;
  flex-shrink: 0;
}

.kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* ── Post footer ── */
.post-footer {
  border-top: 1px solid var(--rule);
  padding-top: 40px;
  margin-bottom: 80px;
}

.post-tags {
  margin-bottom: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags .tag { margin-right: 0; }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.post-nav__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.post-nav__item:hover { opacity: 0.7; }
.post-nav__next { text-align: right; }

.post-nav__dir {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.post-nav__title {
  font-family: var(--ff-display);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink);
}

/* ── Archive pages ── */
.archive-header {
  padding: 56px 0 0;
}

.archive-title {
  font-family: var(--ff-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 12px;
  margin-bottom: 12px;
}

.archive-desc {
  font-size: 1rem;
  color: var(--ink-muted);
  max-width: 480px;
  line-height: 1.75;
}

.author-profile {
  display: flex;
  align-items: center;
  gap: 20px;
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rule);
  flex-shrink: 0;
}

/* ── Error page ── */
.error-page {
  padding: 72px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .site-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .site-nav__links { gap: 16px; }

  .post-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .post-item__date { text-align: left; }

  .post-nav { grid-template-columns: 1fr; }
  .post-nav__next { text-align: left; }

  .kg-bookmark-thumbnail { display: none; }
  .kg-gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
