/* ================================================================
   Quaptor · v3 — A quiet, permanent digital study
   #FAF9F6 纸白 · #181818 · 一条橄榄或暖石色的点缀 · 细线 · 无喧哗
   ================================================================ */

:root {
  --bg: #FAF9F6;
  --bg2: #F2F0EC;
  --tx: #181818;
  --dim: #666660;
  --line: #E8E5DE;
  --line-strong: #D6D2C8;
  --acc: #5C6142;            /* muted olive */
  --serif: 'Newsreader', 'Songti SC', 'Noto Serif CJK SC', 'SimSun', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}
[data-accent="stone"] { --acc: #7A6E5A; }

[data-theme="dark"] {
  --bg: #1C1B19;
  --bg2: #262420;
  --tx: #E9E6E0;
  --dim: #98938A;
  --line: #33302A;
  --line-strong: #45413A;
  --acc: #A9AD8C;
}
[data-theme="dark"][data-accent="stone"] { --acc: #B3A78D; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
}
::selection { background: rgba(120, 120, 100, .18); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

.page { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: min(720px, 100% - 40px); margin-inline: auto; }
.wrap-wide { width: min(960px, 100% - 40px); margin-inline: auto; }
main { flex: 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 页头 ---------- */
.site-head { padding-top: 48px; }
.masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.wordmark {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  display: inline-block;
  line-height: 1.3;
}
.tagline {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.masthead-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.principle {
  margin: 0 0 1px;
  color: var(--dim);
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  line-height: 1.45;
  text-align: right;
}
.principle span { display: block; }
.owner-entry {
  margin-bottom: 2px;
  color: var(--dim);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.owner-entry:hover { color: var(--tx); }
/* 首页：单屏门厅 —— 字标、房间、页脚同一条左基线 */
.home-hall {
  min-height: calc(100svh - 110px);
  display: grid;
  place-items: center start;
  padding-block: 48px 24px;
}
.space-entrance .site-foot { margin-top: 32px; }
.home-hall .wordmark {
  font-size: clamp(40px, 6vw, 52px);
  font-weight: 500;
  letter-spacing: -.025em;
}
.home-hall .tagline { margin-top: 7px; }
.principle span.cjk { font-style: normal; }
.estate-rooms {
  margin-top: clamp(44px, 8vh, 72px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px 64px;
}
.estate-rooms a { text-decoration: none; }
.estate-rooms span {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.25;
}
.estate-rooms small { display: block; margin-top: 6px; color: var(--dim); font-size: 12.5px; }
.estate-rooms a:hover span { color: var(--acc); }
.estate-guestbook {
  display: inline-block;
  margin-top: 44px;
  color: var(--dim);
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  text-decoration: none;
}
.estate-guestbook:hover { color: var(--tx); }
.site-nav {
  margin-top: 30px;
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-link {
  font-size: 13.5px;
  color: var(--dim);
  text-decoration: none;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: color .15s;
}
.nav-link:hover { color: var(--tx); }
.nav-link.active {
  color: var(--tx);
}
.theme-btn {
  margin-left: auto;
  border: 0; background: none; padding: 4px;
  color: var(--dim); cursor: pointer;
  display: grid; place-items: center;
  transition: color .15s;
}
.theme-btn:hover { color: var(--tx); }
.tb-sun { display: none; }
[data-theme="dark"] .tb-sun { display: block; }
[data-theme="dark"] .tb-moon { display: none; }

/* ---------- 时间流 ---------- */
.stream { margin-top: 10px; }
.entry { padding: 34px 0; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry-date { font-size: 12.5px; color: var(--dim); letter-spacing: .03em; }
.entry-title {
  margin: 7px 0 8px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.5;
}
.entry-title a { text-decoration: none; transition: color .15s; }
.entry-title a:hover { color: var(--acc); }
.entry-excerpt {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--dim);
  line-height: 1.9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-meta { font-size: 12.5px; color: var(--dim); }
.entry-meta a { color: var(--dim); text-decoration: none; transition: color .15s; }
.entry-meta a:hover { color: var(--acc); }

/* ---------- 空间秩序 ---------- */

/* Writing desk: fewer rules, looser pages, notes left where they were written. */
.space-desk #main { width: min(720px, 100% - 40px); }
.space-desk .page-head { padding: 64px 0 20px; }
.space-desk .stream { margin-top: 14px; }
.space-desk .entry { padding: 40px 0; }
.space-desk .entry + .entry { border-top: 0; }

/* Reading table: a stable, narrow measure with room around the page. */
.space-table #main { width: min(680px, 100% - 40px); }
.space-table .post-head { padding-top: clamp(96px, 14vw, 138px); }
.space-table .post-body { max-width: 620px; margin-inline: auto; font-size: 17.5px; line-height: 2.04; }
.space-table #comments { max-width: 620px; margin-inline: auto; }
.space-table .post-cover {
  width: min(680px, calc(100vw - 40px));
  margin-inline: auto;
}

/* Bookshelf: years become the frame; titles form the shelves. */
.space-shelf #main { width: min(720px, 100% - 40px); }
.space-shelf .page-head { padding: 64px 0 20px; }
.archive-shelves { margin-top: 30px; }
.arch-group {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 34px;
  padding: 38px 0 44px;
  border-top: 1px solid var(--line);
}

.note-block {
  max-width: 640px;
  padding: 4px 0 2px 22px;
  border-left: 1px solid var(--line-strong);
}
.note-block .md-content {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.9;
}
.note-block .md-content > :first-child { margin-top: 0; }
.note-block .md-content > :last-child { margin-bottom: 0; }
.note-block .entry-meta { margin-top: 10px; }

.chip {
  display: inline-block;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 7px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---------- 正文排版 ---------- */
.md-content { font-size: 16.5px; line-height: 1.95; overflow-wrap: break-word; }
.md-content p { margin: 1em 0; }
.md-content h1, .md-content h2, .md-content h3, .md-content h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.5;
  margin: 1.9em 0 .65em;
}
.md-content h1 { font-size: 1.45em; }
.md-content h2 { font-size: 1.34em; }
.md-content h3 { font-size: 1.15em; }
.md-content a {
  color: var(--tx);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3.5px;
  transition: color .15s, text-decoration-color .15s;
}
.md-content a:hover { color: var(--acc); text-decoration-color: var(--acc); }
.md-content blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--acc);
  color: var(--dim);
}
.md-content blockquote p { margin: .4em 0; }
.md-content code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .85em;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
}
.md-content pre {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.7;
}
.md-content pre code { background: none; padding: 0; font-size: 13.5px; }
.md-content img { max-width: 100%; width: auto; height: auto; border-radius: 2px; display: block; margin: 1.7em auto; }
[data-theme="dark"] .md-content img { filter: brightness(.92); }
.md-content ul, .md-content ol { padding-left: 1.4em; }
.md-content li { margin: .35em 0; }
.md-content li::marker { color: var(--dim); }
.md-content hr { border: none; border-top: 1px solid var(--line-strong); width: 72px; margin: 2.6em auto; }
.md-content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: .92em; }
.md-content th, .md-content td { border: 1px solid var(--line); padding: 7px 12px; }
.md-content th { font-weight: 600; background: var(--bg2); }

/* ---------- 文章页 ---------- */
.post-head { padding: clamp(72px, 12vw, 118px) 0 18px; }
.post-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(46px, 7.2vw, 64px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.08;
}
.post-meta { margin-top: 24px; font-size: 12px; color: var(--dim); letter-spacing: .025em; }
/* 作者控件：仅登录时可见 —— 编辑 / 发布 / 转私密 */
.owner-bar { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.owner-bar-tag {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 1px 7px;
}
.owner-bar .inline-form { display: inline; margin: 0; }
.owner-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; color: var(--dim);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-strong); transition: color .15s;
}
.owner-btn:hover { color: var(--tx); }
.owner-btn-go { color: var(--acc); text-decoration-color: var(--acc); }
.owner-btn-go:hover { color: var(--acc); }
.owner-share { margin-left: auto; }
.note-single .owner-bar { margin-top: 20px; }
.owner-bar { flex-wrap: wrap; }

/* 页面定位说明（Library / Journal 顶部一句） */
.page-note {
  margin: 4px 0 0;
  max-width: 560px;
  color: var(--dim);
  font-family: var(--serif);
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.6;
}
.post-meta a { color: var(--dim); text-decoration: none; transition: color .15s; }
.post-meta a:hover { color: var(--acc); }
.post-cover { margin: 28px 0 4px; text-align: center; }
.post-cover img { max-width: 100%; width: auto; height: auto; border-radius: 2px; display: inline-block; }
.post-body { padding: 42px 0 4px; }
.note-single { margin-top: 40px; }

.pn-nav {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pn { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.pn small { font-size: 11.5px; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.pn span { font-family: var(--serif); font-size: 15.5px; transition: color .15s; }
.pn:hover span { color: var(--acc); }
.pn.next { text-align: right; }

/* ---------- 页面标题 ---------- */
.page-head { padding: 46px 0 10px; }
.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.4;
}
.page-sub { margin: 8px 0 0; font-size: 13.5px; color: var(--dim); }

.sec-h {
  margin: 52px 0 6px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

/* ---------- 留言 ---------- */
.comments { list-style: none; padding: 0; margin: 10px 0 0; }
.comment { padding: 16px 0; }
.comment + .comment { border-top: 1px solid var(--line); }
.comment:target { background: linear-gradient(to right, transparent, var(--bg2) 8%, var(--bg2) 92%, transparent); }
.c-head { font-size: 13.5px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.c-author { font-weight: 600; }
.c-owner { color: var(--acc); font-size: 12px; }
.c-time { color: var(--dim); font-size: 12px; margin-left: auto; }
.c-body { margin-top: 5px; font-size: 15px; line-height: 1.85; }
.no-comments { color: var(--dim); font-size: 14px; }

.comment-form { margin: 26px 0 0; display: flex; flex-direction: column; gap: 10px; }
.comment-form .input-name { max-width: 220px; }
.cf-foot { display: flex; justify-content: flex-end; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- 表单 ---------- */
.input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--tx);
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--dim); }
.input::placeholder { color: var(--dim); opacity: .75; }
textarea.input { resize: vertical; line-height: 1.8; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tx);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--bg2); }
.btn-primary { background: var(--tx); color: var(--bg); border-color: var(--tx); }
.btn-primary:hover { background: var(--tx); opacity: .82; }
.btn-sm { padding: 4px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-danger { color: #A3372E; }
[data-theme="dark"] .btn-danger { color: #D08376; }
.btn-danger:hover { background: rgba(163, 55, 46, .07); }
.text-btn {
  border: 0; background: none; padding: 0;
  font-size: 13px; color: var(--dim);
  cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.text-btn:hover { color: var(--tx); }

/* ---------- 归档 ---------- */
.arch-year {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}
.arch-list { list-style: none; margin: 0; padding: 0; }
.arch-list li { display: flex; gap: 20px; align-items: baseline; padding: 8px 0; }
.arch-list time { font-size: 12.5px; color: var(--dim); flex-shrink: 0; width: 46px; font-variant-numeric: tabular-nums; }
.arch-list a { font-size: 15.5px; text-decoration: none; transition: color .15s; }
.arch-list a:hover { color: var(--acc); }
.arch-note { color: var(--dim); }

/* ---------- Library ---------- */
.library-tools { display: flex; gap: 24px; margin: 6px 0 0; }
.library-tools a { color: var(--dim); font-size: 12.5px; text-decoration: none; }
.library-tools a:hover { color: var(--tx); }

/* ---------- 标签 ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 22px; padding: 0; list-style: none; }
.tag-list a { font-size: 15px; text-decoration: none; transition: color .15s; }
.tag-list a:hover { color: var(--acc); }
.tag-list sup { color: var(--dim); font-size: 11px; margin-left: 3px; }

/* ---------- 相册 ---------- */
.albums { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 26px; }
.album-card { text-decoration: none; display: block; }
.album-cover {
  aspect-ratio: 4 / 3;
  background: var(--bg2);
  border-radius: 4px;
  overflow: hidden;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.album-card:hover .album-cover img { opacity: .9; }
.album-empty { display: grid; place-items: center; height: 100%; color: var(--dim); font-size: 13px; }
.album-card b { display: block; margin-top: 10px; font-size: 15px; font-weight: 500; }
.album-card span { font-size: 12.5px; color: var(--dim); }

.photos { margin-top: 6px; }
.photo { margin: 38px 0; }
.photo a { display: block; }
.photo img { width: 100%; border-radius: 2px; display: block; }
.photo figcaption { margin-top: 10px; font-size: 13px; color: var(--dim); }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; }
.lightbox::backdrop { background: rgb(14 13 12 / .94); }
.lightbox img { max-width: 94vw; max-height: 86vh; display: block; margin: 0 auto; }
.lb-caption { color: #A8A49C; text-align: center; font-size: 13px; margin: 12px 0 0; }
.lb-close {
  position: fixed; top: 14px; right: 20px;
  border: 0; background: none;
  color: #8A867E; font-size: 26px; line-height: 1;
  cursor: pointer; padding: 6px;
}
.lb-close:hover { color: #fff; }

/* ---------- 搜索 ---------- */
.search-big { display: flex; gap: 10px; margin-top: 24px; }
.search-big .input { flex: 1; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 6px;
}
.pagination a { font-size: 13.5px; color: var(--dim); text-decoration: none; }
.pagination a:hover { color: var(--tx); }
.pg-info { font-size: 12.5px; color: var(--dim); }

/* ---------- 提示页 ---------- */
.msg-page { padding: 90px 0 40px; }
.msg-title { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0 0 10px; }
.msg-text { color: var(--dim); font-size: 15px; margin: 0 0 22px; }
.msg-text a { color: var(--tx); }
.msg-link { font-size: 14px; color: var(--tx); text-underline-offset: 3px; }

/* ---------- 页脚 ---------- */
.site-foot {
  margin-top: 120px;
  padding: 0 0 52px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--dim);
}
.site-foot a { color: var(--dim); text-decoration: none; }
.site-foot a:hover { color: var(--tx); }

/* ---------- 通知 ---------- */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 99;
  background: var(--tx); color: var(--bg);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  animation: toastIn .15s ease;
}
.toast.out, .toast.auto { animation: toastIn .15s ease, toastOut .2s ease 2.3s forwards; }
@keyframes toastIn { from { opacity: 0; } }
@keyframes toastOut { to { opacity: 0; } }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .site-head { padding-top: 34px; }
  .masthead { align-items: flex-start; }
  .masthead-side { align-items: flex-end; flex-direction: column; gap: 6px; }
  .principle { font-size: 12.5px; }
  .site-nav { gap: 16px; padding: 12px 0; flex-wrap: wrap; }
  .home-hall { padding-block: 44px 28px; }
  .home-hall .wordmark { font-size: 38px; }
  .estate-rooms { grid-template-columns: 1fr; gap: 24px; }
  .estate-rooms span { font-size: 23px; }
  .estate-guestbook { margin-top: 36px; }
  .page-title { font-size: 25px; }
  .entry-title { font-size: 20px; }
  .space-desk .page-head, .space-shelf .page-head { padding-top: 52px; }
  .space-table .post-body { font-size: 17px; }
  .arch-group { grid-template-columns: 1fr; gap: 20px; padding: 34px 0 38px; }
  .arch-year { font-size: 28px; }
  .note-block { max-width: none; }
  .pn-nav { grid-template-columns: 1fr; }
  .pn.next { text-align: left; }
  .albums { grid-template-columns: 1fr 1fr; gap: 16px; }
  .comment-form .input-name { max-width: none; }
}
