/* 莫蘭迪色系：灰調的鼠尾草綠、乾燥玫瑰、霧藍、沙色、淡紫 */
:root {
  --bg: #F2EEE9;
  --surface: #FAF8F5;
  --surface-2: #EAE4DD;
  --text: #46403C;
  --muted: #847A73;
  --line: #DCD4CB;
  --sage: #A7B5A3;
  --sage-deep: #6F8270;
  --rose: #CDAAA2;
  --rose-deep: #9E7569;
  --blue: #A6B2BE;
  --sand: #D3C2A4;
  --lilac: #B3A6B6;
  --on-accent: #FFFFFF;
  --shadow: 0 1px 2px rgba(70, 64, 60, .05), 0 8px 24px rgba(70, 64, 60, .06);
  --radius: 18px;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', -apple-system, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #25221F; --surface: #2E2A27; --surface-2: #38332F; --text: #EAE3DB; --muted: #A89D94; --line: #463F39;
    --sage: #8E9F8B; --sage-deep: #B2C2AE; --rose: #A9877F; --rose-deep: #D9B5AC; --blue: #8A97A4; --sand: #A99878; --lilac: #958899;
    --on-accent: #1F1C1A; --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #25221F; --surface: #2E2A27; --surface-2: #38332F; --text: #EAE3DB; --muted: #A89D94; --line: #463F39;
  --sage: #8E9F8B; --sage-deep: #B2C2AE; --rose: #A9877F; --rose-deep: #D9B5AC; --blue: #8A97A4; --sand: #A99878; --lilac: #958899;
  --on-accent: #1F1C1A; --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.75 var(--sans); letter-spacing: .01em;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.35; margin: 0; letter-spacing: .02em; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; outline: none; padding-bottom: 48px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* 頂部 */
.banner { background: var(--sand); color: #3E372F; font-size: 13px; text-align: center; padding: 6px 16px; }
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: 15px; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); font-weight: 500; }
.header-tools { display: flex; gap: 8px; align-items: center; }

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 8px 12px; }
  .header-tools { margin-left: auto; }
  .nav { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer;
  font-size: 15px; font-weight: 500; line-height: 1.2; transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--rose-deep); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg, .icon { width: 16px; height: 16px; flex: none; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }

/* 首頁主視覺 */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center; padding: 72px 0 56px; }
.hero-logo { width: 168px; height: 168px; border-radius: 50%; object-fit: cover; background: var(--surface-2); box-shadow: 0 0 0 10px var(--surface), 0 0 0 11px var(--line); }
.eyebrow { color: var(--sage-deep); font-weight: 500; margin: 0 0 4px; letter-spacing: .08em; }
.hero h1 { font-size: clamp(36px, 7vw, 56px); }
.tagline { font-size: 18px; color: var(--muted); margin: 12px 0 28px; max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 24px; padding: 48px 0 32px; }
  .hero-logo { width: 128px; height: 128px; margin: 0 auto; }
  .tagline { margin-inline: auto; }
  .hero-actions { justify-content: center; }
}

/* 區塊 */
.section { padding: 48px 0; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.sec-title { font-size: 26px; display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; }
.sec-title .num { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--rose-deep); letter-spacing: .12em; }
.about p { margin: 0 0 14px; max-width: 40em; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { padding: 5px 14px; border-radius: 999px; background: var(--surface-2); font-size: 14px; }
.chip.c0 { background: color-mix(in srgb, var(--sage) 35%, var(--surface)); }
.chip.c1 { background: color-mix(in srgb, var(--rose) 35%, var(--surface)); }
.chip.c2 { background: color-mix(in srgb, var(--blue) 35%, var(--surface)); }
.chip.c3 { background: color-mix(in srgb, var(--sand) 40%, var(--surface)); }
.chip.c4 { background: color-mix(in srgb, var(--lilac) 35%, var(--surface)); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.col-title { font-size: 17px; margin: 0 0 14px; color: var(--muted); font-family: var(--sans); font-weight: 500; letter-spacing: .06em; }
.col-title + .chips { margin-top: 0; }
* + .col-title { margin-top: 28px; }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--sage); }
.timeline .when { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.timeline .what { font-weight: 700; font-family: var(--serif); font-size: 17px; }
.timeline .desc { color: var(--muted); font-size: 15px; margin: 2px 0 0; }

.sub-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sub-head a { font-size: 14px; color: var(--sage-deep); text-decoration: none; }
.sub-head a:hover { text-decoration: underline; }
.rows { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; text-decoration: none; border-top: 1px solid var(--line); transition: background .2s; min-width: 0; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row-date { font-size: 13px; color: var(--muted); width: 52px; flex: none; font-variant-numeric: tabular-nums; }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 15px; }

.contact-note { margin: 0 0 20px; font-size: 17px; }
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.contact {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; transition: transform .2s; min-width: 0;
}
.contact:hover { transform: translateY(-2px); }
.contact .ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.contact .ic svg { width: 20px; height: 20px; }
.contact:nth-child(5n+1) .ic { background: color-mix(in srgb, var(--sage) 40%, var(--surface)); }
.contact:nth-child(5n+2) .ic { background: color-mix(in srgb, var(--rose) 40%, var(--surface)); }
.contact:nth-child(5n+3) .ic { background: color-mix(in srgb, var(--blue) 40%, var(--surface)); }
.contact:nth-child(5n+4) .ic { background: color-mix(in srgb, var(--sand) 45%, var(--surface)); }
.contact:nth-child(5n+5) .ic { background: color-mix(in srgb, var(--lilac) 40%, var(--surface)); }
.contact .lbl { font-size: 13px; color: var(--muted); }
.contact .val { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact > div { min-width: 0; }

/* 列表頁 */
.page-head { padding: 48px 0 24px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; }
.page-head > div { flex: 1; min-width: 220px; }
.page-head h1 { font-size: 34px; }
.page-head p { margin: 6px 0 0; }
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.search {
  width: 100%; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  outline: none; transition: border-color .2s;
}
.search:focus { border-color: var(--sage-deep); }
.tagbar { display: flex; flex-wrap: wrap; gap: 6px; }
.tagbar button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.tagbar button.on { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--on-accent); }
.day-filter { display: flex; align-items: center; gap: 10px; font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; overflow: hidden; transition: transform .2s; min-width: 0;
}
.card:hover { transform: translateY(-3px); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--surface-2) center / cover no-repeat; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.card h3 { font-size: 19px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tag { font-size: 13px; color: var(--sage-deep); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--rose) 30%, var(--surface)); color: var(--rose-deep); }
.badge svg { width: 12px; height: 12px; }
.mood { font-size: 16px; line-height: 1; }

/* 月曆 */
.cal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 20px; max-width: 460px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head strong { font-family: var(--serif); font-size: 17px; }
.cal-head button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font-size: 20px; color: var(--muted); }
.cal-head button:hover { background: var(--surface-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; border: 0; border-radius: 12px; background: transparent; cursor: default; font-size: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; color: var(--muted);
}
.cal-day.has { cursor: pointer; color: var(--text); background: color-mix(in srgb, var(--mc, var(--sage)) 30%, var(--surface)); font-weight: 500; }
.cal-day.has:hover { filter: brightness(.97); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--sage-deep); }
.cal-day.sel { background: var(--sage-deep); color: var(--on-accent); }
.cal-day .e { font-size: 13px; line-height: 1; }

/* 單篇 */
.entry { max-width: 720px; margin: 0 auto; padding-top: 40px; }
.entry-back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 20px; }
.entry-back:hover { color: var(--text); }
.entry h1 { font-size: clamp(28px, 5vw, 38px); margin: 8px 0 12px; }
.entry-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.entry-actions { display: flex; gap: 8px; margin-left: auto; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 28px 0 8px; }
.gallery.one { grid-template-columns: 1fr; }
.gallery button { border: 0; padding: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; background: var(--surface-2); aspect-ratio: 1; }
.gallery.one button { aspect-ratio: auto; min-height: 120px; max-height: 520px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.prose { font-size: 17px; line-height: 1.9; margin-top: 28px; overflow-wrap: anywhere; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 24px; margin: 1.6em 0 .6em; }
.prose h3 { font-size: 20px; margin: 1.4em 0 .5em; }
.prose h4 { font-size: 18px; margin: 1.2em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose blockquote { margin: 0 0 1.1em; padding: 4px 0 4px 18px; border-left: 3px solid var(--rose); color: var(--muted); }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.prose a { color: var(--sage-deep); text-underline-offset: 3px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.entry-tags { margin-top: 32px; display: flex; gap: 10px; flex-wrap: wrap; }
.entry-tags a { text-decoration: none; }

/* 編輯器 */
.editor { max-width: 760px; margin: 0 auto; padding-top: 40px; }
.editor h1 { font-size: 30px; margin-bottom: 24px; }
.field { margin-bottom: 20px; }
.field > label, .field > .lbl { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.input, .textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none;
}
.input:focus, .textarea:focus { border-color: var(--sage-deep); }
.textarea { min-height: 300px; resize: vertical; line-height: 1.8; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .row-fields { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 16px; border-radius: 999px; font-size: 14px; }
.seg input:checked + span { background: var(--surface); box-shadow: var(--shadow); font-weight: 500; }
.seg input:focus-visible + span { outline: 2px solid var(--sage-deep); }
.moods { display: flex; flex-wrap: wrap; gap: 8px; }
.moods label { cursor: pointer; }
.moods input { position: absolute; opacity: 0; pointer-events: none; }
.moods span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; background: var(--surface); }
.moods input:checked + span { border-color: var(--sage-deep); background: color-mix(in srgb, var(--sage) 30%, var(--surface)); }
.moods input:focus-visible + span { outline: 2px solid var(--sage-deep); }
.vis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vis label { cursor: pointer; }
.vis input { position: absolute; opacity: 0; pointer-events: none; }
.vis .opt { display: block; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); height: 100%; }
.vis .opt b { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.vis .opt small { color: var(--muted); font-size: 13px; }
.vis input:checked + .opt { border-color: var(--sage-deep); box-shadow: inset 0 0 0 1px var(--sage-deep); }
.vis input:focus-visible + .opt { outline: 2px solid var(--sage-deep); }
.ed-tabs { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ed-preview { min-height: 300px; padding: 4px 16px; border: 1px dashed var(--line); border-radius: 12px; margin-top: 0; }
.ph-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ph-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2) center / cover no-repeat; }
.ph-item button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(40, 36, 33, .65); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ed-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.ed-actions .btn.danger { margin-right: auto; }
.notice { max-width: 520px; margin: 80px auto; text-align: center; }
.google-btn { background: var(--surface); gap: 10px; }
.google-btn .icon { width: 18px; height: 18px; }
.google-btn.big { padding: 12px 26px; font-size: 16px; box-shadow: var(--shadow); }
.login-logo { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px; }
.login-title { font-size: 28px; margin-bottom: 4px; }
.notice p { color: var(--muted); }

/* 頁尾、提示、燈箱 */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 92vh; }
.lightbox::backdrop { background: rgba(28, 25, 23, .82); }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; object-fit: contain; }
.lb-close { position: fixed; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
