/* ===== 素往来 · 日系极简风格 ===== */
:root {
  --paper: #f6f3ec;
  --paper-2: #efe9df;
  --card: #fbf9f4;
  --ink: #2c2a27;
  --ink-soft: #5c574f;
  --muted: #978e7f;
  --line: #ddd5c7;
  --line-soft: #e8e1d4;
  --seal: #9e4a3c;
  --seal-soft: rgba(158, 74, 60, 0.08);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --max: 760px;
  --max-wide: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

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

/* ===== 顶部导航 ===== */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(246, 243, 236, 0.86);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.18em;
  font-weight: 600;
}
.brand small {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.nav {
  display: flex;
  gap: 26px;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.nav a { color: var(--ink-soft); transition: color 0.2s; position: relative; padding-bottom: 4px; }
.nav a:hover, .nav a.active { color: var(--seal); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--seal);
}

/* ===== 布局 ===== */
.wrap { max-width: var(--max); margin: 0 auto; padding: 56px 28px 96px; }
.wrap-wide { max-width: var(--max-wide); margin: 0 auto; padding: 56px 28px 96px; }

/* ===== 文章列表 ===== */
.section-title {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin: 0 0 28px;
  display: flex; align-items: center; gap: 14px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.post-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: opacity 0.2s;
}
.post-item:hover { opacity: 0.72; }
.post-date {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
.post-main h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}
.post-excerpt { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 12px; }
.post-cover {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-badge {
  display: inline-block; font-size: 11px;
  color: #fff; background: var(--seal);
  padding: 1px 8px; border-radius: 3px;
  letter-spacing: .06em; margin-right: 8px;
  vertical-align: middle; font-family: var(--sans);
}
.cat-badge:hover { background: var(--ink); color: #e8e2d6; text-decoration: none !important; }

/* ===== 首页分类导航 ===== */
.cat-nav {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.cat-nav a {
  color: var(--muted); letter-spacing: .06em; padding: 3px 0;
  border-bottom: 1px solid transparent; transition: all .15s;
}
.cat-nav a:hover { color: var(--seal); border-color: var(--seal-soft); }
.cat-nav a.active { color: var(--seal); border-color: var(--seal); font-weight: 500; }
.cat-nav .cat-count {
  font-size: 11px; color: var(--line); margin-left: 3px;
}
.tag {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--seal);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 9px;
  background: var(--card);
  transition: all 0.2s;
}
.tag:hover { background: var(--seal-soft); border-color: var(--seal); }

/* ===== 文章详情 ===== */
.post-header { text-align: center; padding: 24px 0 40px; border-bottom: 1px solid var(--line-soft); margin-bottom: 40px; }
.post-header h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 18px;
  line-height: 1.5;
}
.post-meta { color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }
.post-meta .dot { margin: 0 10px; opacity: 0.5; }
.post-content { font-family: var(--serif); font-size: 17px; line-height: 2.05; color: #34302b; }
.post-content h1, .post-content h2, .post-content h3 {
  font-weight: 600; letter-spacing: 0.04em; margin: 1.8em 0 0.7em; line-height: 1.6;
}
.post-content h2 { font-size: 23px; border-left: 3px solid var(--seal); padding-left: 14px; }
.post-content h3 { font-size: 19px; }
.post-content p { margin: 0 0 1.2em; }
.post-content img { margin: 1.6em auto; border: 1px solid var(--line-soft); }
.post-content blockquote {
  margin: 1.6em 0; padding: 4px 22px; border-left: 2px solid var(--line);
  color: var(--ink-soft); font-style: normal;
}
.post-content code {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: var(--paper-2); padding: 2px 6px; border-radius: 3px; font-size: 0.88em;
}
.post-content pre { background: var(--ink); color: #e8e2d6; padding: 18px 20px; overflow: auto; border-radius: 4px; }
.post-content pre code { background: none; padding: 0; color: inherit; }
.post-content a { color: var(--seal); border-bottom: 1px solid var(--seal-soft); }
.post-content ul, .post-content ol { padding-left: 1.4em; margin: 0 0 1.2em; }

/* ===== 文章防复制保护 ===== */
.post-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.post-content * { cursor: default; }
.post-content img { pointer-events: none; }

.back-link { display: inline-block; margin-top: 48px; color: var(--muted); font-size: 14px; letter-spacing: 0.1em; }
.back-link:hover { color: var(--seal); }

/* ===== 标签页 ===== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.tag-cloud a {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
}
.tag-cloud a:hover { color: var(--seal); border-color: var(--seal); }
.tag-cloud .count { font-size: 12px; color: var(--muted); font-family: var(--sans); margin-left: 4px; }

/* ===== 关于页 ===== */
.about-portrait {
  width: 132px; height: 132px; border-radius: 50%;
  margin: 0 auto 28px; object-fit: cover;
  border: 1px solid var(--line); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 34px; color: var(--muted);
}
.about-text { text-align: center; max-width: 560px; margin: 0 auto; color: var(--ink-soft); font-family: var(--serif); font-size: 17px; line-height: 2.1; }
.about-text p { margin: 0 0 1.2em; }
.about-contact { text-align: center; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; margin-top: 36px; }

/* ===== 相册 ===== */
.album-gate {
  max-width: 420px; margin: 80px auto; text-align: center;
}
.album-gate h2 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.1em; margin-bottom: 10px; }
.album-gate p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.code-input {
  width: 100%; padding: 13px 16px; font-size: 16px; text-align: center;
  letter-spacing: 0.2em; border: 1px solid var(--line); background: var(--card);
  border-radius: 3px; font-family: var(--sans);
}
.code-input:focus { outline: none; border-color: var(--seal); }

.btn {
  display: inline-block; cursor: pointer; font-family: var(--sans);
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 11px 26px; letter-spacing: 0.16em; font-size: 14px; border-radius: 3px;
  transition: all 0.2s; border-radius: 3px;
}
.btn:hover { background: var(--seal); border-color: var(--seal); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); }
.btn-block { width: 100%; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.album-card { cursor: pointer; position: relative; }
.album-card .lock-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.82); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.album-card .thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border: 1px solid var(--line-soft); filter: saturate(0.92); transition: all 0.3s;
}
.album-card:hover .thumb { filter: saturate(1.05); opacity: 0.9; }
.album-card h3 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 14px 0 4px; letter-spacing: 0.05em; }
.album-card .desc { color: var(--muted); font-size: 13px; }
.album-card .cnt { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; background: rgba(28,26,23,0.94); z-index: 100;
  display: none; flex-direction: column; padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox-head { display: flex; justify-content: space-between; align-items: center; color: #e8e2d6; margin-bottom: 20px; }
.lightbox-head h3 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.1em; margin: 0; }
.lightbox-close { cursor: pointer; font-size: 26px; color: #e8e2d6; background: none; border: none; }
.lightbox-scroll { overflow-y: auto; flex: 1; }
.lightbox-grid { columns: 3; column-gap: 16px; }
.lightbox-grid img { width: 100%; margin: 0 0 16px; border-radius: 2px; }
.lightbox-cap { color: #b8b0a0; font-size: 12px; text-align: center; margin: -10px 0 16px; font-family: var(--sans); }
.lightbox-grid img { cursor: zoom-in; }

/* ===== 图片放大遮罩 ===== */
.photo-zoom {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 18, 15, 0.94);
  display: none; align-items: center; justify-content: center; flex-direction: column;
  padding: 48px; cursor: zoom-out;
}
.photo-zoom.open { display: flex; }
.photo-zoom img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 2px; box-shadow: 0 10px 50px rgba(0,0,0,.55); }
.photo-zoom .zoom-cap { color: #d8d0c0; margin-top: 16px; font-size: 13px; text-align: center; max-width: 90vw; letter-spacing: .05em; }
.photo-zoom .zoom-close { position: absolute; top: 18px; right: 26px; color: #e8e2d6; font-size: 30px; cursor: pointer; background: none; border: none; line-height: 1; }

/* ===== 拖拽排序 ===== */
.drag-handle { cursor: grab; color: var(--muted); user-select: none; font-size: 16px; line-height: 1; }
.drag-handle:active { cursor: grabbing; }
.drag-handle.sm { position: absolute; top: -9px; left: -7px; font-size: 12px; background: var(--paper); border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 3px; z-index: 2; }
.photo-item { cursor: grab; }
.photo-item.dragging, .admin-row.dragging { opacity: .4; }
.drag-over-before { box-shadow: inset 0 3px 0 var(--seal); }
.drag-over-after { box-shadow: inset 0 -3px 0 var(--seal); }

/* ===== 标签芯片（后台编辑器） ===== */
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border: 1px solid var(--line);
  border-radius: 20px; font-size: 12px;
  background: var(--card); color: var(--text);
  cursor: pointer; transition: all .15s; line-height: 1.6;
}
.tag-chip:hover { border-color: var(--seal); color: var(--seal); }
.tag-chip.selected { background: var(--seal-soft); border-color: var(--seal); color: var(--seal); }
.tag-chip button { background: none; border: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; color: inherit; opacity: .6; }
.tag-chip button:hover { opacity: 1; }

/* ===== 视频容器 ===== */
.video-wrap {
  margin: 1.5em auto; max-width: 100%;
}
.video-wrap iframe,
.video-wrap video {
  display: block; width: 100%; aspect-ratio: 16/9;
  border-radius: 4px; border: 1px solid var(--line-soft);
}

/* ===== 后台 ===== */
.admin-wrap { max-width: 920px; margin: 0 auto; padding: 40px 24px 80px; }
.admin-login { max-width: 360px; margin: 120px auto; text-align: center; }
.admin-login input {
  width: 100%; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--line);
  background: var(--card); border-radius: 3px; font-size: 15px; letter-spacing: 0.1em; text-align: center;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); background: var(--card);
  border-radius: 3px; font-family: var(--sans); font-size: 15px; color: var(--ink); line-height: 1.7;
}
.field textarea { min-height: 260px; resize: vertical; font-family: var(--serif); font-size: 15px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tabs button {
  background: none; border: none; padding: 12px 18px; cursor: pointer;
  font-family: var(--sans); font-size: 14px; letter-spacing: 0.1em; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--seal); border-color: var(--seal); }
.panel { display: none; }
.panel.active { display: block; }
.admin-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft); background: var(--card);
}
.admin-row:last-child { border-bottom: none; }
.admin-row .t { font-family: var(--serif); font-size: 16px; }
.admin-row .m { font-size: 12px; color: var(--muted); }
.admin-row .acts { display: flex; gap: 8px; }
.mini-btn { font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; border-radius: 3px; }
.mini-btn:hover { border-color: var(--seal); color: var(--seal); }
.mini-btn.danger:hover { border-color: var(--seal); color: var(--seal); }
.admin-msg { font-size: 13px; color: var(--seal); min-height: 18px; margin: 10px 0; }

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex; gap: 10px; align-items: center;
  margin: 0 0 26px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 4px;
}
.search-bar input[type="search"] {
  flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line);
  background: var(--paper); border-radius: 3px; font-size: 15px; font-family: var(--sans);
}
.search-bar input[type="search"]:focus { outline: none; border-color: var(--seal); }
.btn-search { background: var(--seal); border-color: var(--seal); color: #fff; padding: 10px 24px; }
.btn-search:hover { background: var(--ink); border-color: var(--ink); }
.search-clear { font-size: 13px; color: var(--muted); letter-spacing: .08em; border-bottom: 1px solid transparent; white-space: nowrap; }
.search-clear:hover { color: var(--seal); border-color: var(--seal-soft); }
.search-bar select {
  padding: 10px 12px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 3px; font-size: 15px; font-family: var(--sans); color: var(--ink-soft); max-width: 160px;
}

/* ===== 翻页 ===== */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin: 42px 0 8px;
}
.pager .pg, .pager .pg-ellipsis {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 3px; font-size: 14px; cursor: pointer; transition: all .15s;
}
.pager .pg:hover:not(.disabled):not(.active) { border-color: var(--seal); color: var(--seal); }
.pager .pg.active { background: var(--seal); border-color: var(--seal); color: #fff; cursor: default; }
.pager .pg.disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-ellipsis { border: none; background: none; cursor: default; min-width: auto; padding: 0 2px; }
.pager .pg-info { width: 100%; text-align: center; font-size: 12px; color: var(--muted); letter-spacing: .08em; margin-top: 4px; }

/* ===== 后台工具栏与翻页 ===== */
.admin-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-toolbar input {
  flex: 1; min-width: 200px; padding: 9px 12px; border: 1px solid var(--line);
  background: var(--paper); border-radius: 3px; font-size: 14px; font-family: var(--sans);
}
.admin-toolbar select.adm-search-cat {
  flex: 0 0 150px; min-width: 120px; padding: 9px 12px; border: 1px solid var(--line);
  background: var(--paper); border-radius: 3px; font-size: 14px; font-family: var(--sans); color: var(--ink-soft);
}
.admin-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 18px 0; }
.admin-pager .pg {
  min-width: 32px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 3px; font-size: 13px; cursor: pointer;
}
.admin-pager .pg:hover:not(.disabled):not(.active) { border-color: var(--seal); color: var(--seal); }
.admin-pager .pg.active { background: var(--seal); border-color: var(--seal); color: #fff; cursor: default; }
.admin-pager .pg.disabled { opacity: .4; cursor: not-allowed; }
.admin-pager .pg-ellipsis { padding: 0 6px; color: var(--muted); font-size: 13px; }

/* ===== 杂项 ===== */
.empty { text-align: center; color: var(--muted); padding: 60px 0; letter-spacing: 0.1em; }
.footer {
  border-top: 1px solid var(--line-soft);
  text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 0.16em;
  padding: 32px 0; margin-top: 60px;
}
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 11px 22px; border-radius: 4px;
  font-size: 13px; letter-spacing: 0.08em; opacity: 0; transition: opacity 0.3s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== 响应式（平板 / 手机 / 小屏） ===== */
@media (max-width: 900px) {
  .wrap, .wrap-wide { padding: 48px 24px 84px; }
  .hero h1 { font-size: 30px; }
  .post-header h1 { font-size: 26px; }
  .lightbox { padding: 28px; }
  .lightbox-grid { columns: 2; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; gap: 12px; align-items: center; text-align: center; }
  .nav { gap: 16px; justify-content: center; flex-wrap: wrap; }
  .post-item { grid-template-columns: 1fr; gap: 6px; padding: 22px 0; }
  .post-date { padding-top: 0; font-size: 12px; }
  .post-header { padding: 18px 0 30px; margin-bottom: 30px; }
  .post-header h1 { font-size: 23px; }
  .post-content { font-size: 16px; line-height: 1.95; }
  .about-portrait { width: 110px; height: 110px; font-size: 28px; }
  .about-text { font-size: 16px; }
  .section-title { font-size: 14px; letter-spacing: 0.2em; margin-bottom: 22px; }
  .album-gate { margin: 56px auto; padding: 0 20px; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
  .lightbox { padding: 18px; }
  .lightbox-grid { columns: 2; }
  .wrap, .wrap-wide { padding: 36px 20px 64px; }
  .tabs { flex-wrap: wrap; }
  .admin-wrap { padding: 28px 18px 64px; }
  .field textarea { min-height: 200px; }
  .admin-login { margin: 80px auto; padding: 0 24px; }
  .search-bar { flex-wrap: wrap; }
  .search-bar input[type="search"] { min-width: 140px; }
  .admin-toolbar input { min-width: 140px; }
  /* 后台内联 flex 表单行在窄屏改为纵向堆叠，避免溢出 */
  [style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
}

@media (max-width: 420px) {
  .post-header h1 { font-size: 21px; }
  .brand { font-size: 20px; }
  .nav { gap: 12px; font-size: 13px; }
  .lightbox { padding: 12px; }
  .lightbox-grid { columns: 1; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .wrap, .wrap-wide { padding: 32px 16px 56px; }
}
