/* ---------------------------------------------------
   Design tokens
--------------------------------------------------- */
:root {
  --bg: #fbfaf8;
  --bg-elevated: #ffffff;
  --text: #2a2a28;
  --text-muted: #6f6c66;
  --text-faint: #a3a099;
  --border: #e6e3dd;
  --accent: #46594f;
  --accent-soft: #eef1ee;
  --code-bg: #f2f0eb;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
    "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Noto Serif SC", "Songti SC",
    serif;

  --content-width: 700px;
  --wide-width: 780px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #17181a;
  --bg-elevated: #1e1f22;
  --text: #e6e4df;
  --text-muted: #98958d;
  --text-faint: #67655f;
  --border: #2b2c2f;
  --accent: #93b3a1;
  --accent-soft: #202824;
  --code-bg: #1d1e21;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181a;
    --bg-elevated: #1e1f22;
    --text: #e6e4df;
    --text-muted: #98958d;
    --text-faint: #67655f;
    --border: #2b2c2f;
    --accent: #93b3a1;
    --accent-soft: #202824;
    --code-bg: #1d1e21;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------
   Reset & base
--------------------------------------------------- */
* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: var(--wide-width);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------
   Header
--------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 28px 0 22px;
}

.site-header__row {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav__list {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 6px 10px;
  font-size: 14.5px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 5px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 620px) {
  .site-nav__list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
    gap: 0;
  }

  .site-nav__list.is-open {
    display: flex;
  }

  .site-nav__list a {
    padding: 10px 4px;
  }

  .site-header__row {
    position: relative;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

/* ---------------------------------------------------
   Footer
--------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 96px;
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer__row {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.site-footer a {
  color: var(--text-muted);
  margin-right: 14px;
  text-decoration: none;
}

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

/* ---------------------------------------------------
   Hero / page intro
--------------------------------------------------- */
.hero {
  padding: 56px 0 40px;
}

.hero h1 {
  font-size: 26px;
  margin: 0 0 12px;
}

.hero p {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 46ch;
  margin: 0 0 6px;
}

.page-intro {
  padding: 44px 0 8px;
}

.page-intro h1 {
  font-size: 24px;
  margin: 0 0 10px;
}

.page-intro p {
  color: var(--text-muted);
  max-width: 52ch;
  margin: 0;
}

/* ---------------------------------------------------
   Section headers
--------------------------------------------------- */
.section {
  padding: 40px 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section__head h2 {
  font-size: 18px;
  margin: 0;
}

.section__head a {
  font-size: 14px;
  text-decoration: none;
  color: var(--text-muted);
}

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

/* ---------------------------------------------------
   Entry lists (notes / projects / resources)
--------------------------------------------------- */
.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.entry:first-child {
  border-top: none;
}

.entry__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.entry__title {
  margin: 0 0 6px;
  font-size: 17.5px;
  font-weight: 600;
}

.entry__title a {
  color: var(--text);
  text-decoration: none;
}

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

.entry__excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 15.5px;
  max-width: 62ch;
}

/* Status / stage marker (signature element) */
.stage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.stage__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.4px solid var(--accent);
  flex-shrink: 0;
}

.stage--seedling .stage__dot {
  background: transparent;
}

.stage--growing .stage__dot {
  background: linear-gradient(90deg, var(--accent) 50%, transparent 50%);
}

.stage--evergreen .stage__dot {
  background: var(--accent);
}

/* ---------------------------------------------------
   Tags
--------------------------------------------------- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 20px;
  text-decoration: none;
}

.tag:hover {
  color: var(--accent);
}

/* ---------------------------------------------------
   Article / prose
--------------------------------------------------- */
.article-head {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--border);
}

.article-head__eyebrow {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.article-head__eyebrow a {
  color: var(--text-faint);
  text-decoration: none;
}

.article-head h1 {
  font-size: 30px;
  margin: 0 0 14px;
}

.article-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.prose {
  padding: 36px 0 20px;
  font-family: var(--font-serif);
  font-size: 18.5px;
  line-height: 1.8;
}

.prose p {
  margin: 0 0 22px;
}

.prose h2 {
  font-family: var(--font-sans);
  font-size: 21px;
  margin: 38px 0 14px;
}

.prose h3 {
  font-family: var(--font-sans);
  font-size: 18px;
  margin: 30px 0 12px;
}

.prose ul,
.prose ol {
  margin: 0 0 22px;
  padding-left: 22px;
}

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

.prose blockquote {
  margin: 28px 0;
  padding-left: 18px;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.prose pre {
  background: var(--code-bg);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.5px;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
}

.article-foot {
  padding: 28px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 8px;
  font-size: 14.5px;
}

.article-nav a {
  text-decoration: none;
  max-width: 45%;
}

/* ---------------------------------------------------
   Project cards
--------------------------------------------------- */
.project-card {
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.project-card:first-child {
  border-top: none;
}

.project-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.project-card__title {
  margin: 0;
  font-size: 18px;
}

.project-card__title a {
  color: var(--text);
  text-decoration: none;
}

.project-card__title a:hover {
  color: var(--accent);
}

.status-pill {
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.project-card__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 15.5px;
}

.project-meta {
  list-style: none;
  margin: 24px 0;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.project-meta dt {
  font-size: 12.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.project-meta dd {
  margin: 0;
  font-size: 15px;
}

/* ---------------------------------------------------
   Resources
--------------------------------------------------- */
.resource-group {
  margin-bottom: 8px;
}

.resource-group h3 {
  font-size: 16px;
  margin: 0 0 4px;
}

.resource-group__note {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 0 0 16px;
}

.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-item {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.resource-item:first-child {
  border-top: none;
}

.resource-item__title {
  font-weight: 600;
  font-size: 15.5px;
  margin-bottom: 3px;
}

.resource-item__meta {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.resource-item__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* ---------------------------------------------------
   Archive
--------------------------------------------------- */
.archive-year {
  margin-bottom: 40px;
}

.archive-year h2 {
  font-size: 20px;
  margin: 0 0 4px;
}

.archive-year__count {
  color: var(--text-faint);
  font-size: 13.5px;
  margin: 0 0 16px;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-list li {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 15px;
  align-items: baseline;
}

.archive-list li:first-child {
  border-top: none;
}

.archive-list time {
  color: var(--text-faint);
  font-size: 13px;
  flex-shrink: 0;
  width: 70px;
}

.archive-list a {
  color: var(--text);
  text-decoration: none;
}

.archive-list a:hover {
  color: var(--accent);
}

.archive-note {
  color: var(--text-muted);
  font-size: 14.5px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 8px;
}

/* ---------------------------------------------------
   About
--------------------------------------------------- */
.about-body {
  padding: 8px 0 20px;
  font-size: 17px;
}

.about-body p {
  margin: 0 0 20px;
  max-width: 60ch;
}

/* ---------------------------------------------------
   404
--------------------------------------------------- */
.not-found {
  padding: 100px 0;
  text-align: left;
}

.not-found h1 {
  font-size: 48px;
  margin: 0 0 14px;
  color: var(--text-faint);
}

.not-found p {
  color: var(--text-muted);
  margin: 0 0 22px;
}
