@font-face {
  font-family: "NotoSerifSC";
  src: url("/static/fonts/noto-serif-sc-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "NotoSerifSC";
  src: url("/static/fonts/noto-serif-sc-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair";
  src: url("/static/fonts/playfair-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair";
  src: url("/static/fonts/playfair-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1A3263;
  --ink: #E8E2DB;
  --ink-soft: rgba(232, 226, 219, 0.72);
  --panel: #547792;
  --line: rgba(84, 119, 146, 0.55);
  --accent: #FAB95B;
  --accent-hover: #E3A847;
  --accent-text: #FAB95B;
  --on-accent: #1A3263;
  --font-cn: "NotoSerifSC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-en: "Playfair", Georgia, "Times New Roman", serif;
}

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

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

body {
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(84, 119, 146, 0.16), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='0.05'/%3E%3C/svg%3E"),
    var(--bg);
  background-attachment: fixed, fixed, fixed, scroll;
  color: var(--ink);
  font-family: var(--font-cn);
  line-height: 1.8;
  font-size: 17px;
}

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

.wrap { max-width: 680px; margin: 0 auto; padding: 0 20px; }

/* ===== 头部 ===== */
.site-header {
  padding: 48px 0 26px;
  border-bottom: 1px solid var(--line);
}
.site-title {
  font-family: var(--font-en);
  font-size: 30px;
  letter-spacing: 3px;
  color: var(--ink);
  font-weight: 700;
}
.site-title:hover { color: var(--accent); }
.site-desc { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }

/* ===== 首页双栏:内容居中 + 日历右侧 ===== */
.home-wrap { max-width: 960px; }
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  align-items: start;
  padding: 26px 0 0;
}
.home-main { min-width: 0; }
.home-side {
  position: sticky;
  top: 24px;
}

/* ===== 日历 ===== */
.calendar {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(18, 55, 94, 0.35);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-title { font-size: 14px; letter-spacing: 1px; color: var(--ink); }
.cal-nav {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.cal-nav:hover { background: var(--panel); color: var(--ink); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 13px;
}
.cal-dow { color: var(--ink-soft); padding-bottom: 2px; }
.cal-blank { }
.cal-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 5px;
  color: var(--ink);
}
.cal-day:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.cal-day i {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-text);
}
.cal-day.has { font-weight: 700; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--line); }
.cal-day.selected { background: var(--accent); color: var(--bg); }
.cal-day.selected i { background: var(--bg); }
.cal-day.selected:hover { background: var(--accent-hover); color: var(--bg); }

/* ===== 日期筛选提示条 ===== */
.date-banner {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 8px;
  margin: 14px 0 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ===== 分页 ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px 0 10px;
  font-size: 14px;
}
.pager-link { color: var(--accent-text); }
.pager-link:hover { color: var(--accent); text-decoration: none; }
.pager-link.disabled { color: var(--ink-soft); cursor: default; }
.pager-info { color: var(--ink-soft); }

/* ===== 首页/列表 ===== */
.post-list { padding: 24px 0 40px; }
.post-item { padding: 22px 0; border-bottom: 1px solid var(--line); }
.post-item:first-child { border-top: 1px solid var(--line); }

.post-item-title { font-family: var(--font-en); font-size: 22px; line-height: 1.5; margin-bottom: 6px; }
.post-item-title a { color: var(--ink); }
.post-item-title a:hover { color: var(--accent-text); }

.post-item-excerpt { font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; }

.post-item-note { margin-bottom: 8px; }
.post-item-note a {
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-item-note a:hover { color: var(--accent-text); }
.post-item-note p { margin: 0 0 0.4em; }
.post-item-note img { max-width: 100%; border-radius: 6px; margin: 4px 0; }
.post-item-note blockquote { border-left: 3px solid var(--line); padding-left: 10px; margin: 6px 0; color: var(--ink-soft); }

.post-meta {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== 详情页 ===== */
.post { padding: 30px 0 60px; }
.post-title { font-family: var(--font-en); font-size: 32px; line-height: 1.35; margin-bottom: 12px; }
.post .post-meta { margin-bottom: 24px; }

.post-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 6px;
  margin: 4px 0 24px;
}

.post-body > * { margin-bottom: 1em; }
.post-body h1, .post-body h2, .post-body h3 {
  font-family: var(--font-en);
  font-size: 24px;
  line-height: 1.4;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}
.post-body h2 { font-size: 21px; }
.post-body h3 { font-size: 18px; }
.post-body img { max-width: 100%; border-radius: 6px; margin: 6px 0; }
.post-body blockquote {
  border-left: 3px solid var(--line);
  padding: 4px 16px;
  margin: 16px 0;
  color: var(--ink-soft);
  font-style: italic;
}
.post-body code {
  background: var(--panel);
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: Menlo, Monaco, Consolas, monospace;
}
.post-body pre {
  background: var(--panel);
  padding: 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
}
.post-body pre code { background: none; padding: 0; }
.post-body ul, .post-body ol { padding-left: 1.6em; }
.post-body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.post-body a { text-decoration: none; color: var(--accent); }

.post-back { margin-top: 40px; font-size: 15px; }

/* ===== 表情反应 ===== */
.reactions {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.reactions-label {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.reactions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.react-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.react-btn:hover { background: var(--panel); border-color: var(--accent-text); }
.react-btn .react-emoji { font-size: 18px; line-height: 1; }
.react-btn .react-count { font-size: 13px; color: var(--ink-soft); }
.react-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.react-btn.on .react-count { color: var(--bg); }

/* ===== 翻译按钮(琥珀微光玻璃胶囊) ===== */
.translate-btn,
.translate-item-btn {
  --tr-glow: rgba(250, 185, 91, 0.38);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  letter-spacing: 0.5px;
  color: var(--accent-text);
  background: linear-gradient(180deg, rgba(250, 185, 91, 0.12), rgba(250, 185, 91, 0.03));
  border: 1px solid rgba(250, 185, 91, 0.45);
  border-radius: 999px;
  cursor: pointer;
  transition: box-shadow 0.25s, transform 0.15s, background 0.25s, border-color 0.25s, color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.translate-btn {
  font-size: 13.5px;
  padding: 6px 18px 6px 14px;
  margin: 0 0 20px;
}
.translate-item-btn {
  font-size: 12px;
  padding: 3px 12px 3px 9px;
  margin-top: 8px;
}

.translate-ic {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.translate-btn:hover,
.translate-item-btn:hover {
  box-shadow: 0 0 0 1px rgba(250, 185, 91, 0.35), 0 3px 16px var(--tr-glow);
  transform: translateY(-1px);
}

.translate-btn:active,
.translate-item-btn:active { transform: translateY(0) scale(0.97); }

/* 翻译中:地球旋转 + 呼吸光 */
.translate-btn[data-state="loading"] .translate-ic,
.translate-item-btn[data-state="loading"] .translate-ic {
  animation: tr-spin 0.9s linear infinite;
}
.translate-btn[data-state="loading"],
.translate-item-btn[data-state="loading"] {
  animation: tr-breathe 1.2s ease-in-out infinite;
  cursor: wait;
}

/* 已翻译:琥珀实底 */
.translate-btn[data-state="translated"],
.translate-item-btn[data-state="translated"] {
  color: var(--bg);
  background: linear-gradient(180deg, #FCC77C, var(--accent));
  border-color: transparent;
  box-shadow: 0 2px 18px var(--tr-glow);
  animation: tr-pop 0.32s ease;
}

/* 切换状态时按钮弹一下 */
.translate-btn[data-state="original"],
.translate-item-btn[data-state="original"] {
  animation: tr-pop 0.32s ease;
}

/* 正文翻译后淡入 */
.tr-fade { animation: tr-fade 0.5s ease; }

@keyframes tr-spin { to { transform: rotate(360deg); } }
@keyframes tr-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes tr-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 185, 91, 0); }
  50% { box-shadow: 0 0 14px rgba(250, 185, 91, 0.45); }
}
@keyframes tr-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ===== 关于页 ===== */
.about { padding: 10px 0 40px; }

/* ===== 相册页 ===== */
.page-title { font-size: 22px; letter-spacing: 2px; margin: 24px 0 18px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 10px 0 40px;
}
.photo-item { margin: 0; }
.photo-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  transition: transform .15s;
}
.photo-item img:hover { transform: scale(1.02); }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 14, 26, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.lightbox.show { opacity: 1; pointer-events: auto; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(232, 226, 219, 0.15);
  border: none;
  color: #E8E2DB;
  font-size: 26px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(232, 226, 219, 0.3); }
.lightbox-close { top: 18px; right: 18px; }
.lightbox-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lightbox-caption {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: #E8E2DB;
  font-size: 13px;
  opacity: .8;
}

/* ===== 后台图片管理 ===== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.image-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  padding-bottom: 6px;
}
.image-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.image-item .image-meta { padding: 4px 6px; font-size: 11px; color: var(--ink-soft); word-break: break-all; }
.image-item .del-image {
  display: block;
  margin: 0 6px 4px;
  padding: 2px 0;
  font-size: 11px;
  width: calc(100% - 12px);
}

/* ===== 页脚 ===== */
.site-footer {
  padding: 24px 0 48px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.site-footer p { margin: 2px 0; }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  border: 1px solid var(--accent-text);
  color: var(--accent-text);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 0 8px;
  line-height: 1.7;
  border-radius: 3px;
}

/* ===== 空态 ===== */
.empty { padding: 60px 0; text-align: center; color: var(--ink-soft); }

/* ===== 后台 ===== */
.admin-page .wrap { max-width: 900px; }
.section-title {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 18px;
}
.login-box { text-align: center; padding: 60px 0; }
.login-box input {
  display: block;
  margin: 20px auto;
  padding: 8px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
}
.login-box .btn { margin: 0 auto; }

.admin-grid { display: grid; grid-template-columns: 1fr 320px; gap: 40px; padding: 24px 0 40px; }

/* ===== 后台顶部导航 ===== */
.admin-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  background: rgba(26, 50, 99, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin: 16px 0 26px;
}
.admin-nav-link {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  font-size: 14px;
  color: var(--ink-soft);
  border-radius: 5px;
}
.admin-nav-link:hover { color: var(--ink); background: rgba(232, 226, 219, 0.08); text-decoration: none; }
.admin-nav-link.active { color: var(--bg); background: var(--accent); }

/* ===== 编辑 + 预览双栏 ===== */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.preview-pane {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  min-height: 320px;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(18, 55, 94, 0.25);
}
.preview-empty { color: var(--ink-soft); font-style: italic; }

.section-title { display: flex; align-items: center; gap: 12px; }
.edit-cancel { font-size: 13px; color: var(--ink-soft); }
.edit-cancel:hover { color: var(--accent-text); }

.preview-toggle { font-size: 13px; color: var(--ink-soft); }

/* ===== 列表搜索筛选 ===== */
.list-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
#post-search { flex: 1; min-width: 200px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.filter-btn.active:hover { background: var(--accent-hover); color: var(--bg); }
.post-count { font-size: 13px; color: var(--ink-soft); font-weight: normal; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--accent-text); margin-bottom: 4px; }
.field-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.field-row label { font-size: 13px; color: var(--accent-text); }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); }
textarea { resize: vertical; line-height: 1.6; }
.check { display: flex; align-items: center; gap: 4px; }
.check input { width: auto; }

.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--accent-text); }
.btn.ghost:hover { background: var(--panel); color: var(--accent-hover); }
.btn.danger { border-color: #a53f34; background: transparent; color: #a53f34; }
.btn.danger:hover { background: #a53f34; color: var(--on-accent); }

.hint { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.upload-row { display: flex; gap: 8px; }
.upload-row input { flex: 1; }

.post-list .list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-date { font-size: 12px; color: var(--ink-soft); }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== 页面跳转动画(View Transitions) ===== */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: vt-out 0.18s ease both;
}
::view-transition-new(root) {
  animation: vt-in 0.28s ease both;
}
@keyframes vt-out {
  to { opacity: 0; transform: translateY(-8px); }
}
@keyframes vt-in {
  from { opacity: 0; transform: translateY(14px); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; gap: 20px; }
  .home-side { position: static; order: -1; }
}
@media (max-width: 760px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-pane { min-height: 200px; max-height: 40vh; }
}
@media (max-width: 700px) {
  .site-header { padding: 28px 0 18px; }
  .post-title { font-size: 26px; }
  .admin-grid { grid-template-columns: 1fr; gap: 28px; }
}
