/* Blog — minimal, light/dark auto */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-soft: #fafafa;
  --fg: #1c1c1c;
  --fg-muted: #6b6b6b;
  --fg-faint: #9a9a9a;
  --line: #ebebeb;
  --line-strong: #dcdcdc;
  --accent: #1a8a3f;
  --code-bg: #f6f7f6;
  --code-fg: #24352b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1011;
    --bg-soft: #16181a;
    --fg: #e8e8e8;
    --fg-muted: #9ea3a6;
    --fg-faint: #6f7477;
    --line: #23262a;
    --line-strong: #31363b;
    --accent: #4ecb7a;
    --code-bg: #161a18;
    --code-fg: #cfe3d6;
    --shadow: none;
  }
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: Comfortaa, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
}

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

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.name { font-size: 15px; font-weight: 500; color: var(--fg); }

.nav { display: flex; align-items: center; height: 100%; }

.nav-item {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-item:hover { color: var(--accent); text-decoration: none; }
.nav-item.active { color: var(--fg); }

/* Layout */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 20px 96px;
}

/* Blog index */

.page-title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 14px;
  margin-bottom: 48px;
}

.post-list { list-style: none; }

.post-item { border-top: 1px solid var(--line); }
.post-item:last-child { border-bottom: 1px solid var(--line); }

.post-link {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  padding: 26px 0;
  color: inherit;
}

.post-link:hover { text-decoration: none; }
.post-link:hover .post-title { color: var(--accent); }

.post-thumb {
  flex: none;
  width: 180px;
  min-width: 0;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--bg-soft);
}

.post-body { flex: 1 1 auto; min-width: 0; }

.post-meta {
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.post-title {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 8px;
  transition: color 0.15s;
}

.post-excerpt {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.7;
}

.tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: 11px;
  color: var(--fg-muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 10px;
}

.empty-note {
  margin-top: 48px;
  font-size: 13px;
  color: var(--fg-faint);
}

/* Post */

.post-header { margin-bottom: 36px; }

.post-header h1 {
  font-size: 30px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 8px 0 14px;
}

.post-standfirst {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.7;
}

.article h2 {
  font-size: 21px;
  font-weight: 500;
  line-height: 1.4;
  margin: 48px 0 14px;
}

.article h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 32px 0 10px;
}

.article p { margin-bottom: 18px; }

.article ul,
.article ol { margin: 0 0 18px 22px; }

.article li { margin-bottom: 8px; }

.article strong { font-weight: 500; color: var(--fg); }

.article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

figure { margin: 32px 0; }

figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--line);
}

figcaption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-faint);
  text-align: center;
}

figcaption a { color: var(--fg-faint); text-decoration: underline; }

.hero { margin: 0 0 40px; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 4px;
  padding: 2px 6px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 18px;
}

pre code {
  background: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--code-fg);
}

blockquote {
  border-left: 2px solid var(--line-strong);
  padding-left: 18px;
  margin: 0 0 18px;
  color: var(--fg-muted);
}

.callout {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 18px;
  font-size: 14px;
}

.callout p:last-child { margin-bottom: 0; }

.table-scroll { overflow-x: auto; margin-bottom: 18px; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
}

.post-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--fg-muted);
}

.back-link { display: inline-block; margin-top: 24px; font-size: 13px; }

/* Before / after comparison */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 32px 0 10px;
}

.compare figure { margin: 0; }

.compare img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.compare figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* Phone screenshots */

.shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 32px 0 10px;
  align-items: start;
}

.shots figure { margin: 0; }

.shots img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
}

.shots figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--fg-faint);
}

/* Project link buttons */

.repo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 24px;
}

.repo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  transition: border-color 0.15s, color 0.15s;
}

.repo-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.repo-btn svg { width: 15px; height: 15px; }

.repo-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.repo-btn.primary:hover {
  color: #fff;
  filter: brightness(1.08);
}

/* Spec list */

.spec {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0 0 18px;
  font-size: 14px;
}

.spec dt { color: var(--fg-muted); }
.spec dd { margin: 0; }

/* Persistent back bar on article pages */

.post-nav {
  position: sticky;
  top: var(--header-h, 56px);
  z-index: 90;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.post-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Copy link / share */

.post-actions { display: flex; align-items: center; gap: 6px; }

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.done { border-color: var(--accent); color: var(--accent); }
.action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.share-wrap { position: relative; }

.share-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 120;
  min-width: 150px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.share-menu a {
  display: block;
  padding: 7px 12px;
  border-radius: 5px;
  color: var(--fg);
  font-size: 13px;
}

.share-menu a:hover {
  background: var(--bg-soft);
  color: var(--accent);
  text-decoration: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}

.back-btn:hover { color: var(--accent); text-decoration: none; }
.back-btn svg { width: 15px; height: 15px; }

.article .wrap-top { padding-top: 40px; }

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    gap: 0;
    padding: 8px 12px;
  }
  .nav {
    width: 100%;
    overflow-x: auto;
    padding-top: 8px;
  }
  .nav-item {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .wrap { padding: 32px 16px 64px; }
  .compare { grid-template-columns: 1fr; gap: 10px; }
  .shots { grid-template-columns: 1fr; gap: 18px; }
  .shots img { max-width: 300px; margin: 0 auto; }
  .spec { grid-template-columns: 1fr; gap: 2px 0; }
  .spec dd { margin-bottom: 10px; }
  .post-nav-inner { padding: 0 16px; }
  .back-btn { height: 38px; font-size: 12px; }
  .action-btn { height: 28px; padding: 0 10px; font-size: 11px; }
  .action-btn span { display: none; }
  .action-btn.done span { display: inline; }
  .post-link {
    flex-direction: column;
    gap: 14px;
  }
  .post-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  .page-title { font-size: 23px; }
  .post-header h1 { font-size: 24px; }
  .post-standfirst { font-size: 15px; }
  .article h2 { font-size: 18px; margin-top: 38px; }
}
