:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text: #2a2a28;
  --muted: #8a877f;
  --faint: #e8e5de;
  --accent: #6b7f73;
  --accent-soft: #e6ece7;
  --danger: #b4645a;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1b;
    --surface: #232523;
    --text: #e7e5df;
    --muted: #8f8d86;
    --faint: #333532;
    --accent: #9db3a6;
    --accent-soft: #2b332e;
    --danger: #d68b80;
  }
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; transition: color .25s var(--ease), opacity .25s var(--ease); }
a:hover { color: var(--accent); }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 880px; }
.page { flex: 1; padding-top: 48px; padding-bottom: 80px; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }

/* Header */
.site-header { padding: 28px 0 0; }
.header-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: .01em; }
.brand-dot { color: var(--accent); }
.nav { display: flex; align-items: baseline; gap: 20px; font-size: 14px; color: var(--muted); }
.nav-link:hover { color: var(--text); }
.nav-user { color: var(--text); opacity: .7; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--muted);
  cursor: pointer; transition: color .25s var(--ease);
}
.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--danger); }

.site-footer { padding: 32px 0 40px; font-size: 13px; color: var(--muted); }

/* Motion */
.fade { animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Intro */
.intro h1, .form-page h1, .article-head h1 {
  font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; line-height: 1.25;
}
.intro h1 { font-size: 34px; margin: 0 0 4px; }
.intro p { margin: 0 0 28px; font-size: 14px; }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--faint);
  animation: rise .6s .05s var(--ease) both;
}
.filters select, .filters input[type="date"] {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13px; color: var(--text);
  background: transparent; border: 1px solid var(--faint); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; transition: border-color .25s var(--ease), background .25s var(--ease);
}
.filters select { padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 11px) 52%; background-size: 4px 4px; background-repeat: no-repeat; }
.filters select:hover, .filters input:hover, .filters select:focus, .filters input:focus { border-color: var(--accent); outline: none; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.dash { color: var(--muted); }
.clear { font-size: 13px; color: var(--muted); margin-left: 4px; }

/* Post list */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
  padding: 22px 0; border-bottom: 1px solid var(--faint);
  animation: rise .55s calc(.08s + var(--i, 0) * .04s) var(--ease) both;
}
.post-title {
  display: inline-block; font-family: var(--serif); font-size: 21px; line-height: 1.35; margin-bottom: 4px;
  transition: color .25s var(--ease), transform .35s var(--ease);
}
.post-title:hover { transform: translateX(3px); }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 6px; }
.sep { opacity: .5; }
.category { color: var(--accent); }
.tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 12px; color: var(--muted); background: var(--accent-soft);
  padding: 1px 9px; border-radius: 999px; transition: color .25s var(--ease), background .25s var(--ease);
}
a.tag:hover { color: var(--text); }
.empty { color: var(--muted); padding: 40px 0; }
.empty a { color: var(--accent); }

.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 28px; font-size: 14px; color: var(--muted); }
.pager a:hover { color: var(--text); }
.pager-info { font-size: 12px; }

/* Article */
.article-head { max-width: 720px; margin: 0 auto 32px; }
.article-head h1 { font-size: 36px; margin: 0 0 10px; }
.article-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.article-sub .tags { margin-top: 10px; }
.content-column { max-width: 760px; margin: 0 auto; }
.post-frame {
  display: block; width: 100%; height: 70vh; border: 0; border-radius: var(--radius);
  background: #fff; opacity: 0; transition: opacity .5s var(--ease), height .3s var(--ease);
}
.post-frame.ready { opacity: 1; }
.back { max-width: 720px; margin: 40px auto 0; font-size: 14px; color: var(--muted); }

/* Forms */
.form-page { max-width: 560px; }
.form-page.narrow { max-width: 380px; }
.form-page h1 { font-size: 30px; margin: 0 0 6px; }
.form-page > .muted { margin: 0 0 24px; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 24px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.field em { font-style: normal; opacity: .7; }
.field input:not([type="file"]), .chips {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--faint); border-radius: 10px; padding: 10px 12px;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.field input:focus, .chips:focus-within {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px 8px; cursor: text; }
.chips input { flex: 1; min-width: 120px; border: 0 !important; box-shadow: none !important; padding: 3px 4px !important; background: transparent !important; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px;
  background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 2px 6px 2px 10px;
  animation: pop .25s var(--ease) both;
}
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

.dropzone {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 96px; padding: 18px; border: 1px dashed var(--faint); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); font-size: 14px;
  transition: border-color .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--text); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); color: var(--text); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.actions .danger { margin-left: auto; }
.btn {
  font: inherit; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px; border-radius: 999px; border: 1px solid var(--text);
  background: var(--text); color: var(--bg); cursor: pointer;
  transition: transform .2s var(--ease), opacity .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.btn:hover { color: var(--bg); opacity: .88; }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--faint); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); opacity: 1; }
.btn-sm { padding: 4px 14px; font-size: 13px; margin-top: 10px; }
.link { font-size: 13px; color: var(--muted); }

.alert {
  margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger);
  animation: rise .35s var(--ease) both;
}

.landing main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.landing-line {
  margin: 0; text-align: center; font-family: var(--serif); font-weight: 400;
  font-size: clamp(22px, 4vw, 34px); letter-spacing: .01em; color: var(--text);
  animation-duration: 1.4s;
}

.error-page { text-align: center; padding: 60px 0; color: var(--muted); }
.error-code { font-family: var(--serif); font-size: 64px; color: var(--text); margin: 0; opacity: .8; }
