/* =========================================================
   DW · 貼文備份 — 象牙白 × 香檳金 × 玫瑰紫
   ========================================================= */
:root {
  --bg: #f6efe6;
  --card: #fffcf7;
  --text: #2e1f2c;
  --muted: #8b7682;
  --line: #ecdfcf;
  --gold: #b48a3c;
  --gold-hi: #e6c886;
  --gold-lo: #94692a;
  --gold-grad: linear-gradient(135deg, #f1dca4 0%, #c79a4b 38%, #9a6c2a 62%, #e9cd8c 100%);
  --accent: #9a3b63;          /* 玫瑰紫：連結、重點 */
  --accent-soft: #f6e4eb;
  --bubble: #f6eeee;
  --bubble-line: #efe1e3;
  --hover: #fbf1e2;
  --heading: #4a2a40;
  --title-grad: linear-gradient(180deg, #4a2a40, #7a3a5a);
  --glow1: #f3dfe6;
  --glow2: #ebe2f3;
  --glow3: #f4e6d0;
  --pill: var(--gold-grad);
  --pill-text: #fff;
  --radius: 18px;
  --serif: "Songti TC", "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  --shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 2px 4px rgb(90 50 40 / .04), 0 12px 32px rgb(120 70 50 / .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 16px/1.75 "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow1) 0%, transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, var(--glow2) 0%, transparent 55%),
    radial-gradient(900px 900px at 50% 120%, var(--glow3) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); }
img { display: block; max-width: 100%; }

/* ---------- profile header ---------- */
.profile { max-width: 760px; margin: 0 auto; padding: 0 0 4px; }
.cover {
  position: relative;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--line);
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgb(46 31 44 / .28));
  pointer-events: none;
}
.cover-img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
@media (min-width: 760px) {
  .profile { padding-top: 20px; }
  .cover {
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--gold-hi), 0 0 0 5px var(--card), 0 0 0 6px var(--line), var(--shadow);
  }
}
.profile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: -64px;
  padding: 0 20px;
  position: relative;
}
.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  padding: 4px;
  background: var(--gold-grad);
  box-shadow: 0 0 0 4px var(--card), 0 8px 24px rgb(120 70 50 / .25);
}
.who { margin-top: 10px; }
.who h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: .12em;
  background: var(--title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  margin: 4px 0 0;
  color: var(--gold-lo);
  font-size: 15px;
  letter-spacing: .08em;
}
.tagline::before, .tagline::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  margin: 0 10px;
  vertical-align: middle;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.tagline::after { background: linear-gradient(90deg, var(--gold), transparent); }
.stats span { white-space: nowrap; }
.stats { text-wrap: balance; margin: 4px 0 0; color: var(--muted); font-size: 13px; letter-spacing: .04em; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.tabs a {
  position: relative;
  padding: 6px 22px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] {
  color: var(--pill-text);
  background: var(--pill);
  box-shadow: 0 2px 10px rgb(154 108 42 / .35), inset 0 1px 0 rgb(255 255 255 / .5);
  text-shadow: 0 1px 1px rgb(90 60 20 / .35);
}

/* ---------- layout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 22px 12px 40px; }
.panel { display: grid; gap: 22px; }
.js .panel { display: none; }
.js .panel.active { display: grid; }
.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
/* 卡片頂端一條金色細線 */
.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-grad);
  opacity: .85;
  z-index: 1;
}

/* ---------- posts ---------- */
.post { overflow: hidden; }
.post-head { display: flex; gap: 12px; align-items: center; padding: 18px 20px 0; }
.mini-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  padding: 2px;
  background: var(--gold-grad);
}
.mini-avatar.initial {
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--gold-hi);
  background: linear-gradient(135deg, hsl(var(--h) 45% 72%), hsl(calc(var(--h) + 30) 40% 55%));
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.post-title { font-size: 15px; line-height: 1.45; }
.post-title strong { font-weight: 700; }
.post-title a { color: inherit; text-decoration: none; }
.post-head time { color: var(--muted); font-size: 13px; }
.post-head a.time { color: inherit; text-decoration: none; }
.post-head a.time:hover time { color: var(--accent); }
.post-text { margin: 14px 20px 0; overflow-wrap: anywhere; }
.post-tags, .post-note { margin: 8px 20px 0; color: var(--muted); font-size: 14px; }
.post-link { margin: 8px 20px 0; overflow-wrap: anywhere; font-size: 14px; }
.post-text a, .post-tags a, .cmt-text a, .bubble a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
}
.post-text a:hover, .post-tags a:hover, .cmt-text a:hover { background: var(--accent-soft); }

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  margin-top: 16px;
  background: var(--card);
}
.ph {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--line);
  aspect-ratio: 1;
  grid-column: span 2;
}
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, filter .5s ease; }
.ph:hover img { transform: scale(1.04); filter: brightness(1.04) saturate(1.05); }
.ph.hidden { display: none; }
.ph:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

.n1 .ph { grid-column: span 6; aspect-ratio: auto; max-height: 720px; }
.n1 .ph img { height: auto; max-height: 720px; object-fit: contain; margin: 0 auto; }
.n2 .ph { grid-column: span 3; }
.n3 .ph:first-child, .n4 .ph:first-child { grid-column: span 6; aspect-ratio: 16 / 10; }
.n3 .ph:not(:first-child) { grid-column: span 3; }
.n5 .ph:nth-child(-n+2) { grid-column: span 3; }
.grid.all { grid-template-columns: repeat(3, 1fr); }
.grid.all .ph { grid-column: auto; }
.grid.avatar-update .ph { aspect-ratio: auto; max-height: 520px; background: var(--card); }
.grid.avatar-update .ph img { max-height: 520px; object-fit: contain; }

.more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgb(74 42 64 / .55), rgb(154 108 42 / .45));
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgb(0 0 0 / .3);
}

.post-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 0;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.grid + .post-foot { margin-top: 0; border-top: 0; }
a.post-foot { transition: background .2s; }
a.post-foot:hover { background: linear-gradient(90deg, transparent, var(--hover) 40%, var(--hover) 60%, transparent); }
.post-foot .go {
  margin-left: auto;
  color: var(--gold-lo);
  font-weight: 700;
  letter-spacing: .06em;
  text-decoration: none;
}
.post-foot .go:hover { color: var(--accent); }
.heart { color: #d4507a; }
.muted { color: var(--muted); }

/* ---------- albums ---------- */
.album { padding: 20px 20px 20px; }
.album h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .1em;
  color: var(--heading);
}
.album h2::before { content: "✦ "; color: var(--gold); font-size: 14px; vertical-align: 2px; }
.count { color: var(--gold-lo); font-weight: 400; font-size: 14px; font-family: inherit; }
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.album-grid .ph { grid-column: auto; border-radius: 10px; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .08em;
  padding: 8px 16px 48px;
}
.foot::before { content: "❦"; display: block; color: var(--gold); font-size: 22px; margin-bottom: 4px; }

/* ---------- post page ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar a { text-decoration: none; font-weight: 700; }
.topbar .back { color: var(--gold-lo); letter-spacing: .06em; }
.topbar .back:hover { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); letter-spacing: .1em; }
.brand .mini-avatar { width: 32px; height: 32px; }
.detail .post-foot.static { border-top: 1px solid var(--line); }
.comments-box { padding: 6px 20px 20px; border-top: 1px solid var(--line); }
.comments-box .post-note { margin: 12px 0 0; }
.cmts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.cmt { display: flex; gap: 10px; align-items: flex-start; }
.cmt.reply { margin-left: 48px; }
.cmt .mini-avatar { width: 36px; height: 36px; font-size: 14px; }
.cmt.reply .mini-avatar { width: 30px; height: 30px; font-size: 12px; }
.cmt-main { min-width: 0; }
.bubble {
  display: inline-block;
  margin: 0;
  padding: 9px 16px;
  border-radius: 4px 18px 18px 18px;
  background: var(--bubble);
  border: 1px solid var(--bubble-line);
  overflow-wrap: anywhere;
}
.cmt-author { font-weight: 700; font-size: 14px; }
.cmt-author a, .cmt-author span { color: var(--heading); text-decoration: none; }
.cmt-author a:hover { color: var(--accent); }
.cmt-text { overflow-wrap: anywhere; }
.cmt-meta { font-size: 12px; color: var(--muted); padding: 3px 16px 0; }
.chip {
  display: inline-block;
  margin-top: 4px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--gold-grad);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.pager { display: flex; justify-content: space-between; padding: 4px; font-size: 15px; }
.pager a { color: var(--gold-lo); text-decoration: none; font-weight: 700; letter-spacing: .06em; }
.pager a:hover { color: var(--accent); }

/* ---------- lightbox ---------- */
#lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: radial-gradient(circle at 50% 40%, rgb(52 32 46 / .96), rgb(20 12 18 / .97));
  color: #fff;
}
#lightbox[open] { display: grid; place-items: center; }
#lightbox::backdrop { background: transparent; }
#lightbox figure {
  margin: 0;
  max-width: min(1200px, 100vw);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 48px 56px;
}
#lightbox img { max-height: calc(100dvh - 160px); width: auto; object-fit: contain; box-shadow: 0 0 0 1px rgb(230 200 134 / .4), 0 20px 60px rgb(0 0 0 / .5); }
#lightbox figcaption { max-width: 640px; text-align: center; font-size: 15px; line-height: 1.7; color: #f3e6d2; }
#lightbox figcaption:empty { display: none; }
#lightbox button {
  position: absolute;
  border: 1px solid rgb(230 200 134 / .5);
  background: rgb(255 255 255 / .06);
  color: var(--gold-hi);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
#lightbox button:hover { background: rgb(230 200 134 / .2); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 10px; top: 50%; translate: 0 -50%; }
.lb-next { right: 10px; top: 50%; translate: 0 -50%; }
.lb-count { position: absolute; top: 22px; left: 0; right: 0; text-align: center; font-size: 13px; letter-spacing: .1em; color: var(--gold-hi); opacity: .8; pointer-events: none; }

@media (max-width: 560px) {
  #lightbox figure { padding: 56px 8px 72px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; translate: none; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
  .avatar { width: 104px; height: 104px; }
  .profile-inner { margin-top: -52px; }
  .who h1 { font-size: 28px; }
  .tagline { font-size: 14px; }
  .tagline::before, .tagline::after { display: none; }
  .tabs a { padding: 6px 16px; }
  .post-head, .post-foot { padding-left: 16px; padding-right: 16px; }
  .post-text, .post-tags, .post-note, .post-link { margin-left: 16px; margin-right: 16px; }
  .comments-box { padding: 6px 14px 16px; }
  .cmt.reply { margin-left: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ph img { transition: none; }
}

/* =========================================================
   配色主題（html 的 data-theme 決定；預設 rose）
   ========================================================= */
/* 珍珠薰衣草 */
html[data-theme="lavender"] {
  --bg: #f4f1f7; --card: #fffdff; --text: #2a2338; --muted: #857c94; --line: #e6def0;
  --gold: #b0904a; --gold-hi: #e8d39a; --gold-lo: #8f7032;
  --gold-grad: linear-gradient(135deg, #f3e4b6 0%, #c9a75c 38%, #99773a 62%, #ecd9a2 100%);
  --accent: #6b4a9e; --accent-soft: #ece5f6; --bubble: #f2eef8; --bubble-line: #e4dcf0; --hover: #f3eefa;
  --heading: #3d2c5c; --title-grad: linear-gradient(180deg, #3d2c5c, #6b4a9e);
  --glow1: #e9e0f5; --glow2: #f3e4ec; --glow3: #efe8dc;
  --pill: linear-gradient(135deg, #a88bd0, #6b4a9e);
}
/* 玫瑰金 */
html[data-theme="rosegold"] {
  --bg: #faf0ee; --card: #fffaf8; --text: #3a2225; --muted: #9a7b7e; --line: #f0dcd6;
  --gold: #b9786a; --gold-hi: #efc3b4; --gold-lo: #9a5a4c;
  --gold-grad: linear-gradient(135deg, #f7d9cc 0%, #d39a87 38%, #a8685a 62%, #f2cdbd 100%);
  --accent: #b03f5c; --accent-soft: #fbe3e8; --bubble: #fbeeee; --bubble-line: #f3dcdc; --hover: #fdf0ec;
  --heading: #5a2a36; --title-grad: linear-gradient(180deg, #5a2a36, #b03f5c);
  --glow1: #fbdde3; --glow2: #f8e6dc; --glow3: #f3e2e8;
}
/* 酒紅鎏金 */
html[data-theme="burgundy"] {
  --bg: #f3ebdf; --card: #fffaf1; --text: #2b1418; --muted: #85696a; --line: #e6d5bf;
  --gold: #a8802f; --gold-hi: #e2c27a; --gold-lo: #876220;
  --gold-grad: linear-gradient(135deg, #f0d690 0%, #c29a3e 38%, #8c661d 62%, #e7c873 100%);
  --accent: #7d1f35; --accent-soft: #f3dfe1; --bubble: #f6ecea; --bubble-line: #ead6d3; --hover: #f8eddc;
  --heading: #5a1426; --title-grad: linear-gradient(180deg, #5a1426, #8e2a42);
  --glow1: #ecd6d4; --glow2: #efe0c6; --glow3: #e9d9cc;
  --pill: linear-gradient(135deg, #9a3350, #5a1426); --pill-text: var(--gold-hi);
}

/* 金色變化（html 的 data-gold；antique 古金 = 各主題原本的金）。底色也跟著金色調整 */
html[data-gold="champagne"] {
  --bg: #f5efe6; --card: #fffcf6; --line: #ebe0cf; --hover: #f7efe2;
  --glow1: #efdcd9; --glow2: #f3e9d8; --glow3: #ece2d6;
  --gold: #bfa06c; --gold-hi: #f0e0c0; --gold-lo: #96784a;
  --gold-grad: linear-gradient(135deg, #f7ecd4 0%, #d8bf90 38%, #a98c5c 62%, #f2e3c4 100%);
}
html[data-gold="rosegold"] {
  --bg: #f6ebe8; --card: #fffaf8; --line: #eed9d2; --hover: #fbefea; --bubble: #f8ecec;
  --glow1: #f2d6d9; --glow2: #f5e2da; --glow3: #efdcdc;
  --gold: #b87a68; --gold-hi: #f0c9b8; --gold-lo: #94594a;
  --gold-grad: linear-gradient(135deg, #f6d8ca 0%, #d29c87 38%, #a6695a 62%, #f2cfc0 100%);
}
html[data-gold="bright"] {
  --bg: #f5ecd6; --card: #fffbee; --line: #eadbb5; --hover: #fbf1d6;
  --glow1: #f0d9c8; --glow2: #f6e6b8; --glow3: #efdfc0;
  --gold: #c99a1e; --gold-hi: #ffe08a; --gold-lo: #9a7208;
  --gold-grad: linear-gradient(135deg, #fff0b0 0%, #e2b43a 38%, #b0820c 62%, #ffe38f 100%);
}
html[data-gold="platinum"] {
  --bg: #f1efed; --card: #fefdfc; --line: #e3dfdb; --hover: #f4f1ee; --bubble: #f4eeee; --bubble-line: #e6dcdc;
  --glow1: #ead9dc; --glow2: #e8e6e6; --glow3: #e4e1dd;
  --gold: #9e9a92; --gold-hi: #ebe8e2; --gold-lo: #77736b;
  --gold-grad: linear-gradient(135deg, #f6f4f0 0%, #c8c4bc 38%, #8f8b83 62%, #ece9e3 100%);
}

/* 底色（html 的 data-bg）。放在金色之後，會蓋過金色附帶的底色 */
html[data-bg="champagne"] { --bg: #f5efe6; --card: #fffcf6; --line: #ebe0cf; --hover: #f7efe2; --glow1: #efdcd9; --glow2: #f3e9d8; --glow3: #ece2d6; }
html[data-bg="pearl"]     { --bg: #f8f6f2; --card: #ffffff; --line: #ece6dd; --hover: #f6f2ec; --glow1: #f1e4e4; --glow2: #f3efe6; --glow3: #eeeae4; }
html[data-bg="ivory"]     { --bg: #f7f1e3; --card: #fffdf5; --line: #ebdfc6; --hover: #f8f0dc; --glow1: #f0dfd6; --glow2: #f5ead2; --glow3: #efe5d0; }
html[data-bg="blush"]     { --bg: #f7ecea; --card: #fffaf9; --line: #efdcd8; --hover: #fbefec; --bubble: #f8ecec; --glow1: #f3d8dc; --glow2: #f6e6df; --glow3: #f0dfdf; }
html[data-bg="latte"]     { --bg: #ede2d4; --card: #fbf6ef; --line: #dfcfbb; --hover: #f4eadc; --bubble: #f3e9e4; --glow1: #e6d0c8; --glow2: #ead9c2; --glow3: #e3d4c4; }
html[data-bg="mauve"]     { --bg: #f1ebee; --card: #fffcfd; --line: #e6dbe0; --hover: #f6eff2; --bubble: #f5eef1; --bubble-line: #e9dde3; --glow1: #ead6df; --glow2: #efe6ea; --glow3: #e8e0e2; }
html[data-bg="night"] {
  --bg: #2b1319; --card: #381c23; --text: #f2e6da; --muted: #c4a9a6; --line: #4e2b33; --hover: #42222a;
  --accent: #f3b6c4; --accent-soft: #4f2631; --bubble: #43232b; --bubble-line: #55303a;
  --heading: #f6e3c8; --title-grad: linear-gradient(180deg, #f7e7c8, #d8bf90);
  --gold-lo: #d8bf90;
  --glow1: #4a1c28; --glow2: #3b1d2c; --glow3: #3a2218;
  --pill: var(--gold-grad); --pill-text: #3a1a20;
  --shadow: 0 2px 4px rgb(0 0 0 / .2), 0 12px 32px rgb(0 0 0 / .25);
  color-scheme: dark;
}
html[data-bg="night"] .more { background: linear-gradient(135deg, rgb(20 8 12 / .55), rgb(120 90 40 / .45)); }

/* ---------- 淺色／深色切換按鈕 ---------- */
.mode-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--gold-lo);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.mode-toggle:hover { border-color: var(--gold); transform: rotate(-12deg); }
.mode-toggle::before { content: "☾"; }
html[data-mode="dark"] .mode-toggle::before { content: "☀"; }
.tabs { position: sticky; }
.tabs .mode-toggle { position: absolute; right: 14px; top: 50%; translate: 0 -50%; }
.tabs .mode-toggle:hover { transform: rotate(-12deg); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
body { transition: background-color .3s, color .3s; }
