/* =====================================================================
   Letter — 前台樣式
   參考風格：Noto Serif JP 200、#1e1e1e 文字、#fbf9f9 米白背景、
   固定頁首／頁尾、手機單欄置中、桌機橫向排列。
   ===================================================================== */

:root {
  --bg: #fbf9f9;
  --ink: #1e1e1e;
  --muted: #aaa;
  --line: #d7d7d7;
  --accent: #1208dd;
  --font-serif: 'Noto Serif JP', 'Noto Serif TC', 'Yu Mincho', 'Hiragino Mincho ProN', 'Songti TC', serif;
  --font-sans: 'Yu Gothic', 'Hiragino Sans', 'PingFang TC', 'Noto Sans TC', sans-serif;
  --header-h: 7em;
  --footer-h: 3.5em;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}
html.menu-visible { overflow: hidden; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-serif);
  font-weight: 200;
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.05em;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt";
}

a { color: inherit; text-decoration: none; transition: opacity 300ms ease-out; }
a:hover { opacity: .55; }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { font-weight: 200; margin: 0; }

.screen-reader-text {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0;
}

/* ---------- 頁首 ---------- */
.layout-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 200;
  background-color: var(--bg);
}
.header-pad { height: var(--header-h); }
.footer-pad { height: var(--footer-h); }

.header-container {
  position: relative;
  height: 100%;
  padding: 0 1.786em;
}

.logo-container {
  position: relative;
  top: 1.786em;
  text-align: center;
}
.logo {
  display: inline-block;
  font-size: 1.6em;
  letter-spacing: 0.3em;
  padding-left: 0.3em; /* 補償最後一字的字距 */
  line-height: 1.4;
}

/* 漢堡 */
.menu-toggle {
  position: absolute; left: 1.786em; top: 2.1em;
  width: 1.8em; height: 1.4em;
  padding: 0; border: 0; background: none; cursor: pointer;
  z-index: 203;
}
.menu-toggle span {
  position: absolute; left: 0; right: 0; height: 1px;
  background: var(--ink);
  transition: transform 300ms ease-out, opacity 300ms ease-out, top 300ms ease-out;
}
.menu-toggle span:nth-child(1) { top: 0; }
.menu-toggle span:nth-child(2) { top: 50%; }
.menu-toggle span:nth-child(3) { top: 100%; }
.show-menu .menu-toggle span:nth-child(1) { top: 50%; transform: rotate(45deg); }
.show-menu .menu-toggle span:nth-child(2) { opacity: 0; }
.show-menu .menu-toggle span:nth-child(3) { top: 50%; transform: rotate(-45deg); }

/* 全螢幕選單 */
.main-navigation {
  position: fixed; inset: 0;
  opacity: 0; visibility: hidden;
  background-color: var(--bg);
  transition: all 300ms ease-out;
  z-index: 202;
}
.show-menu .main-navigation { opacity: 1; visibility: visible; }
.main-navigation .menu {
  list-style: none; margin: 0; padding: 0;
  position: relative; top: 50%; transform: translateY(-50%);
  text-align: center;
}
.menu-item { display: block; margin-bottom: 1.6em; font-size: 1.15em; letter-spacing: .2em; position: relative; }
.menu-item.current a::after {
  content: ''; display: block; width: 3em; height: 1px; margin: .3em auto 0;
  background: var(--ink); transform: rotate(-1deg); opacity: .6;
}

/* ---------- 版面 ---------- */
.layout-module {
  padding: 0 2.857em;
  margin: 0 auto;
  max-width: 1024px;
}
.site-main { min-height: calc(100vh - var(--header-h) - var(--footer-h)); }

/* ---------- 頁尾 ---------- */
.layout-footer {
  position: fixed; bottom: 0; left: 0; width: 100%;
  height: var(--footer-h);
  background-color: var(--bg);
  z-index: 100;
}
.footer-container {
  height: 100%; padding: 0 1.786em;
  display: flex; align-items: center; justify-content: center;
}
.copyright {
  font-family: var(--font-sans);
  font-size: 0.786em;
  letter-spacing: .1em;
  color: var(--muted);
}

/* ---------- 裝飾插圖 ---------- */
.illustration { display: none; }
.illustration svg { width: 100%; height: 100%; fill: none; stroke: var(--ink); stroke-width: .8; stroke-linecap: round; opacity: .35; }

/* ---------- 文章列表 ---------- */
.post-list {
  display: flex; flex-flow: column nowrap;
  align-items: center; justify-content: flex-start;
  padding: 2em 0 0;
}
.post-list .item {
  width: 100%; max-width: 30em;
  margin: 0 0 2em;
  position: relative;
}
.post-item .post-link { display: block; }
.post-item .entry-header { text-align: center; }
.post-item .entry-title { font-size: 1.286em; line-height: 1.7; margin-bottom: 0; }
.post-item .entry-meta { margin-bottom: 1.4em; }
.entry-date {
  font-family: var(--font-sans);
  font-size: 0.857em;
  line-height: 1.8;
  letter-spacing: 0.05em;
  color: var(--muted);
}
/* 列表縮圖：固定 16:10 的框，大圖縮進框內、小圖維持原尺寸置中（不放大） */
.post-item .entry-thumbnail {
  width: 100%; max-width: 16em; aspect-ratio: 16 / 10;
  margin: 0 auto 1.4em;
  display: flex; align-items: center; justify-content: center;
}
.post-item .entry-thumbnail img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
}
.post-item .entry-content p { margin: 0; text-align: justify; }

/* 植物小插圖（CSS 內嵌 SVG，線條風） */
.plant {
  width: 7em; height: 7em;
  margin: 0 0 2em;
  align-self: center;
  background: center / auto 100% no-repeat;
  opacity: .55;
}
.plant-leaf   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%231e1e1e' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M50 90 C50 60 50 40 50 20'/%3E%3Cpath d='M50 70 C30 70 20 55 22 40 C40 42 50 55 50 70z'/%3E%3Cpath d='M50 50 C70 50 80 35 78 20 C60 22 50 35 50 50z'/%3E%3C/svg%3E"); }
.plant-sprout { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%231e1e1e' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M30 90 Q50 88 70 90'/%3E%3Cpath d='M50 88 C52 70 48 55 50 40'/%3E%3Cpath d='M50 45 C40 42 32 32 34 22 C44 24 50 34 50 45z'/%3E%3Cpath d='M50 40 C60 36 68 26 66 16 C56 18 50 28 50 40z'/%3E%3C/svg%3E"); }
.plant-grass  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%231e1e1e' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M50 90 C48 70 40 50 30 30'/%3E%3Cpath d='M50 90 C50 65 52 45 55 20'/%3E%3Cpath d='M50 90 C56 72 66 55 76 40'/%3E%3Cpath d='M50 90 C44 78 36 70 24 66'/%3E%3C/svg%3E"); }
.plant-seed   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%231e1e1e' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M50 90 C50 75 50 60 50 48'/%3E%3Cellipse cx='50' cy='38' rx='9' ry='12'/%3E%3Cpath d='M41 38 C30 36 24 28 26 20'/%3E%3Cpath d='M59 38 C70 36 76 28 74 20'/%3E%3Cpath d='M50 26 C50 18 54 12 60 10'/%3E%3C/svg%3E"); }

/* 分頁：列表下方置中 */
.pagination { text-align: center; font-family: var(--font-sans); font-size: .857em; letter-spacing: .1em; padding: 1em 0 3em; }
.pagination a { display: inline-block; margin: 0 .8em; }
.pagination .page-no { color: var(--muted); }
.empty-note { text-align: center; margin: 6em 0; color: var(--muted); }

/* ---------- 單篇 ---------- */
.post-article { padding: 4em 2.857em 6em; max-width: 44em; }
.post-article .entry-header { text-align: center; margin-bottom: 3em; }
.post-article .entry-title { font-size: 1.6em; line-height: 1.7; max-width: 80%; margin: .3em auto 0; }
.post-article .entry-date { color: var(--ink); }
.post-article .image-container { margin-bottom: 3em; }
/* 內頁代表圖：固定 16:10 全欄寬的框，同樣只縮不放大 */
.post-article .post-image {
  margin: 0; width: 100%; aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 500ms ease-in forwards; opacity: 0;
}
.post-article .post-image img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
}
.post-article .entry-content { padding-top: 1em; font-size: 1em; }
.post-article .entry-content p { margin: 0 0 1.6em; text-align: justify; }
.post-article .entry-content h1,
.post-article .entry-content h2,
.post-article .entry-content h3,
.post-article .entry-content h4 { font-size: 1.143em; margin: 2.4em 0 1em; text-align: center; }
.post-article .entry-content blockquote {
  margin: 2.4em 1em; padding: 0 1.2em;
  border-left: 1px solid var(--line);
  color: #555;
}
/* 內文圖片：最寬 75%（桌機 55%），比這小的圖以原尺寸置中顯示 */
.post-article .entry-content img {
  display: block; width: auto; height: auto; max-width: 75%; margin: 3em auto;
}
.post-article .entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 3em 25%; }
.post-article .entry-content a { text-decoration: underline; text-underline-offset: .25em; }
.post-article .entry-content .ql-align-center { text-align: center; }
.post-article .entry-content .ql-align-right { text-align: right; }
.post-article .entry-content .ql-align-justify { text-align: justify; }
.post-article .entry-content ul, .post-article .entry-content ol { padding-left: 1.6em; margin: 0 0 1.6em; }

.post-links {
  display: flex; justify-content: space-between; gap: 2em;
  margin-top: 6em;
  font-size: .9em;
}
.post-links a { max-width: 45%; }
.back-link {
  display: block; text-align: center;
  margin: 6em 0 2em;
  font-family: var(--font-sans); font-size: .857em; letter-spacing: .2em;
}

/* ---------- 作者 ---------- */
.author-box {
  display: flex; align-items: center; gap: 1.4em;
  margin: 5em auto 0; max-width: 32em;
  padding-top: 2.5em; border-top: 1px solid var(--line);
}
/* 連結本身固定尺寸且不可被文字擠壓，圖片才能維持正圓 */
.author-avatar {
  flex: 0 0 auto; display: block; width: 4.6em; height: 4.6em;
  border-radius: 50%; overflow: hidden;
}
.author-avatar img {
  display: block; width: 100%; height: 100%; max-width: none; aspect-ratio: 1 / 1;
  border-radius: 50%; object-fit: cover;
}
.author-meta { min-width: 0; }
.author-name { display: block; font-size: 1.1em; letter-spacing: .15em; }
.author-bio { margin: .3em 0 0; font-size: .9em; color: #666; }

/* ---------- 關於 ---------- */
.profile-page { padding: 4em 2.857em 6em; max-width: 36em; text-align: center; }
.profile-avatar img {
  width: 9em; height: 9em; border-radius: 50%; object-fit: cover;
  display: block; margin: 0 auto 2em;
  animation: fadeIn 500ms ease-in forwards; opacity: 0;
}
.profile-page .entry-title { font-size: 1.5em; letter-spacing: .25em; padding-left: .25em; margin-bottom: 2.5em; }
.profile-page .entry-content { text-align: left; line-height: 2.1; }
.profile-page .muted { color: var(--muted); text-align: center; }

/* ---------- 評論 ---------- */
.comments { margin-top: 6em; padding-top: 3em; border-top: 1px solid var(--line); }
.comments-title { font-size: 1.1em; letter-spacing: .2em; text-align: center; margin-bottom: 2.5em; }
.comments-title .count { font-family: var(--font-sans); font-size: .8em; color: var(--muted); margin-left: .4em; letter-spacing: 0; }
.comment-list { list-style: none; margin: 0 0 3.5em; padding: 0; }
.comment { padding: 1.4em 0; border-bottom: 1px dashed var(--line); }
.comment:first-child { padding-top: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 1em; margin-bottom: .4em; }
.comment-author { letter-spacing: .1em; }
.comment-date { font-family: var(--font-sans); font-size: .8em; color: var(--muted); letter-spacing: .05em; }
.comment-body { font-size: .95em; line-height: 1.9; word-break: break-word; }
.comments-empty { text-align: center; color: var(--muted); margin: 0 0 3em; }

.comment-form { max-width: 32em; margin: 0 auto; }
.comment-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.comment-form .field { display: block; margin-bottom: 1.4em; }
.comment-form .field > span {
  display: block; font-family: var(--font-sans); font-size: .8em; letter-spacing: .15em; color: #666; margin-bottom: .4em;
}
.comment-form input[type=text], .comment-form textarea {
  width: 100%; padding: .7em .9em;
  border: 1px solid var(--line); border-radius: 0; background: transparent;
  font: inherit; color: var(--ink); letter-spacing: .05em; line-height: 1.8;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--ink); }
.comment-form textarea { resize: vertical; }
.comment-submit {
  display: block; margin: 0 auto; padding: .7em 2.6em;
  border: 1px solid var(--ink); border-radius: 0; background: transparent;
  font: inherit; font-family: var(--font-sans); font-size: .85em; letter-spacing: .25em; color: var(--ink);
  cursor: pointer; transition: all 250ms ease-out;
}
.comment-submit:hover { background: var(--ink); color: var(--bg); }
.form-msg { text-align: center; font-size: .9em; margin: 0 0 1.5em; }
.form-msg.error { color: #a4262c; }
.form-msg.success { color: #3b6b3b; }

@keyframes fadeIn { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .post-article .post-image, .profile-avatar img { animation: none; opacity: 1; }
}

/* =====================================================================
   平板以上
   ===================================================================== */
@media only screen and (min-width: 768px) {
  body { font-size: 15px; }
  .post-article .entry-title { max-width: 62.25%; }

  /* 平板：文章列表兩欄網格 */
  .post-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3.5em 3em; align-items: start;
    max-width: 60em; margin: 0 auto; padding: 2.5em 0 3em;
  }
  .post-list .item { max-width: none; margin: 0; min-width: 0; }
  .post-list .plant { display: none; }
}

/* =====================================================================
   桌機：列表改為橫向排列
   ===================================================================== */
@media only screen and (min-width: 1024px) {
  :root { --footer-h: 4em; }
  .layout-module { max-width: 100%; padding: 0 2.5em; }
  .footer-container { justify-content: flex-start; padding: 0 2.5em; }

  .illustration { display: block; position: fixed; z-index: -1; }
  .illustration.letter-overview { top: auto; bottom: 4.5em; left: 3%; width: 26em; height: 8em; }
  .illustration.letter-overview svg { opacity: .18; }
  .illustration.letter-detail { top: 62%; right: 6%; width: 16em; height: 16em; z-index: 1; }

  .site-main { display: flex; align-items: center; }
  .main-content { width: 100%; }

  /* 桌機：每列最多三篇，超過往下堆疊 */
  .post-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4.5em 3.5em;
    max-width: 76em; padding: 3em 0 4em;
  }

  .post-article { padding: 6em 2.5em 8em; max-width: 48em; }
  .post-article .entry-content { padding-top: 2em; font-size: 1.2em; }
  .post-article .entry-content h1,
  .post-article .entry-content h2,
  .post-article .entry-content h3,
  .post-article .entry-content h4 { font-size: 1.3em; }
  .post-article .entry-content img { max-width: 55%; }
  .post-item .entry-thumbnail { max-width: 18em; }
  .post-article .back-link { margin-top: 8em; }
  .profile-page { padding: 6em 2.5em 8em; }
  .profile-page .entry-content { font-size: 1.1em; }
}

@media only screen and (min-width: 1280px) {
  .post-list { gap: 5em 4.5em; }
}
