/* 橘园 全局样式 —— 干净、温暖、有呼吸感，像手写日记本 */

:root {
  --bg: #faf9f7;        /* 背景 off-white */
  --text: #2c2c2a;      /* 正文 */
  --muted: #8a887f;     /* 次要文字 */
  --border: #d3d1c7;    /* 边框 */
  --card: #fff;         /* 卡片背景 */
  --radius: 14px;
  --max-w: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 249, 247, 0.88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 0.5px solid var(--border);
}
.topbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.brand .orange { margin-right: 4px; }
.nav { display: flex; gap: 16px; font-size: 15px; }
.nav a { color: var(--muted); padding: 4px 0; }
.nav a.active, .nav a:hover { color: var(--text); }

/* 主体容器 */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 18px 80px;
}

/* 区块标题 */
.section-title {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title a { font-size: 13px; color: var(--muted); }
.section-title a:hover { color: var(--text); }

/* 卡片 */
.card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.05); }

.card-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card-title { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.card-sub { font-size: 14px; color: var(--muted); margin: -4px 0 10px; }

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  line-height: 1.6;
}
.tag-food   { background: #eaf3de; color: #3b6d11; }
.tag-moment { background: #f0ebe3; color: #6b4c2a; }
.tag-sweet  { background: #e6f1fb; color: #185fa5; }
.tag-deep   { background: #eeedfe; color: #534ab7; }
.tag-work   { background: #faeeda; color: #854f0b; }
.tag-rest   { background: #fbeaf0; color: #993556; }
.tag-default{ background: #f0efe9; color: #6a6960; }

/* 首页欢迎区 */
.hero { text-align: center; padding: 40px 0 8px; }
.hero .big-orange { font-size: 64px; line-height: 1; }
.hero h1 { font-size: 30px; letter-spacing: 4px; margin: 14px 0 6px; }
.hero p { color: var(--muted); margin: 0; }

/* 日记详情 */
.diary-detail .d-meta { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.diary-detail h1 { font-size: 24px; margin: 6px 0 4px; line-height: 1.4; }
.diary-detail .d-sub { color: var(--muted); margin: 0 0 18px; }
.diary-content { font-size: 16px; }
.diary-content img { max-width: 100%; border-radius: 10px; }
.diary-content p { margin: 0 0 14px; }
.diary-closing {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 0.5px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

/* 相册网格（瀑布流用 columns 实现，手机友好） */
.photo-grid {
  column-count: 2;
  column-gap: 12px;
}
@media (min-width: 600px) { .photo-grid { column-count: 3; } }
.photo-item {
  break-inside: avoid;
  margin-bottom: 12px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.photo-item img { width: 100%; display: block; }
.photo-cap { padding: 8px 10px; font-size: 13px; color: var(--muted); }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,20,18,0.9);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 10px; }
.lightbox .lb-cap { color: #eee; margin-top: 14px; font-size: 14px; text-align: center; }
.lightbox .lb-close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 28px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=date], input[type=number], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 220px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 15px;
  background: var(--text); color: var(--bg);
  border: none; border-radius: 999px;
  padding: 10px 22px; cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--muted); border: 0.5px solid var(--border); }
.btn-danger { background: #993556; color: #fff; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* 提示 / 空状态 */
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* 浮动操作按钮 */
.fab {
  position: fixed; right: 18px; bottom: 22px; z-index: 20;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--text); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

/* 密码弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20,20,18,0.4);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 24px;
  width: 100%; max-width: 360px; border: 0.5px solid var(--border);
}
.modal h3 { margin: 0 0 4px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* 身份切换小按钮 */
.who-chip {
  font: inherit; font-size: 13px;
  color: var(--muted);
  background: #f0efe9;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
}
.who-chip:hover { color: var(--text); }

/* 列表卡片上的点赞/评论计数 */
.card-counts { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* 照片角标 */
.photo-item { position: relative; }
.photo-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,0.45); color: #fff;
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
}

/* 互动区（点赞 + 评论）*/
.inter-wrap { margin-top: 24px; }
.interactions {
  border-top: 0.5px solid var(--border);
  padding-top: 16px;
}
.like-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.like-btn {
  font: inherit; font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px;
  background: #f0efe9; color: var(--muted);
  border: 0.5px solid var(--border); border-radius: 999px;
  padding: 6px 16px; cursor: pointer;
}
.like-btn .heart { font-size: 18px; line-height: 1; }
.like-btn.liked { color: #993556; background: #fbeaf0; border-color: #f3cdd9; }
.like-who { font-size: 13px; color: var(--muted); }

/* 评论：聊天气泡 */
.comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.no-cmt { color: var(--muted); font-size: 14px; text-align: center; padding: 8px 0; }
.comment { display: flex; align-items: flex-start; gap: 6px; max-width: 85%; }
.comment.mine { align-self: flex-end; flex-direction: row-reverse; }
.c-bubble {
  background: #f0ebe3; border-radius: 12px; padding: 8px 12px;
}
.comment.mine .c-bubble { background: #e6f1fb; }
.c-author { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.c-text { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.c-del {
  border: none; background: none; color: var(--muted);
  font-size: 16px; cursor: pointer; line-height: 1; padding: 4px;
  opacity: 0.4;
}
.c-del:hover { opacity: 1; }

/* 评论输入 */
.comment-input { display: flex; gap: 8px; }
.comment-input input { flex: 1; }
.comment-input .btn { padding: 10px 18px; white-space: nowrap; }

/* 灯箱改成白色卡片，可滚动 */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,20,18,0.88);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto;
}
.lb-card {
  background: var(--card); border-radius: 16px; overflow: hidden;
  width: 100%; max-width: 560px; margin: auto;
}
.lb-card img { width: 100%; display: block; max-height: 70vh; object-fit: contain; background: #000; }
.lb-body { padding: 16px 18px 20px; }
.lb-cap { font-size: 15px; margin-bottom: 4px; }
.lb-close {
  position: fixed; top: 16px; right: 18px; z-index: 60;
  background: rgba(0,0,0,0.5); color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 24px; cursor: pointer; line-height: 1;
}
/* 大图里始终可见的删除按钮 */
.lb-del {
  position: fixed; top: 16px; left: 18px; z-index: 60;
  background: rgba(153,53,86,0.92); color: #fff; border: none;
  height: 38px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; cursor: pointer; line-height: 38px;
}

/* 返回 + 上一篇/下一篇 */
.back-link {
  display: inline-block; color: var(--muted);
  font-size: 14px; margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }
.prev-next {
  display: flex; gap: 10px; margin-top: 32px;
  border-top: 0.5px solid var(--border); padding-top: 18px;
}
.pn-link {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 0.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px; min-width: 0;
}
.prev-next .pn-link:last-child { text-align: right; }
.pn-dir { font-size: 12px; color: var(--muted); }
.pn-title {
  font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pn-disabled { color: var(--muted); opacity: 0.5; justify-content: center; }
.pn-disabled .pn-dir, .pn-disabled { font-size: 13px; }
