/* 本站自己的介面樣式：搜尋、分享、圖片排版。由 src/seo.ts 在每個頁面注入。 */

/* ---- 圖片排版 ----
   文章內圖片原本一律撐滿欄寬，直式作品圖會變成 1,200×2,100 的長條，一張就佔掉好幾個螢幕。
   限制高度、保持比例、置中；點圖仍可開燈箱看大圖。 */
.gh-content .kg-image-card img,
.gh-content .kg-image-card.kg-width-wide img,
.gh-content .kg-image-card.kg-width-full img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(78vh, 780px);
  margin-inline: auto;
  object-fit: contain;
}
.gh-content .kg-image-card { display: flex; flex-direction: column; align-items: center; }
.gh-content .kg-image-card figcaption { max-width: 720px; text-align: center; }
.gh-article-image img { max-height: min(72vh, 720px); object-fit: cover; }
.gh-content .kg-gallery-image img { object-fit: cover; }
.gh-content .kg-bookmark-thumbnail img { object-fit: cover; }
@media (max-width: 600px) {
  .gh-content .kg-image-card img { max-height: 70vh; }
}

/* ---- 標籤頁 ---- */
.gh-archive-count { margin: 6px 0 0; font-size: 1.5rem; color: var(--color-secondary-text, rgba(0, 0, 0, .55)); letter-spacing: .04em; }

/* ---- 對話框共用 ---- */
body.site-modal-open { overflow: hidden; }
.site-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; justify-content: center; align-items: flex-start;
  padding: clamp(12px, 8vh, 96px) 16px 16px;
  background: rgba(20, 22, 30, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.site-modal[hidden] { display: none; }
.site-panel {
  width: 100%; max-width: 640px; max-height: 100%;
  display: flex; flex-direction: column;
  background: #fff; color: #15171a;
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  overflow: hidden; font-family: var(--font-sans, system-ui, sans-serif);
}
.site-panel * { box-sizing: border-box; }
.site-panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.site-panel-head h2 { margin: 0; font-size: 1.7rem; font-weight: 600; flex: 1; letter-spacing: .02em; }
.site-close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font-size: 2.2rem; line-height: 1; cursor: pointer;
}
.site-close:hover { background: rgba(0, 0, 0, .06); }
.site-panel :focus-visible { outline: 2px solid #4b3fa8; outline-offset: 2px; }

/* ---- 搜尋 ---- */
.site-search-form { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.site-search-form svg { flex: none; width: 20px; height: 20px; opacity: .55; }
.site-search-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 1.8rem; color: inherit; padding: 6px 0;
}
.site-search-input::placeholder { color: rgba(0, 0, 0, .4); }
.site-search-body { overflow-y: auto; padding: 8px 8px 12px; min-height: 120px; }
.site-search-hint { margin: 8px 8px 6px; font-size: 1.35rem; color: rgba(0, 0, 0, .55); }
.site-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px; }
.site-chip {
  font: inherit; font-size: 1.4rem; padding: 4px 14px; border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .15); background: #fff; color: inherit; cursor: pointer;
}
.site-chip:hover { border-color: rgba(0, 0, 0, .5); }
.site-results { list-style: none; margin: 0; padding: 0; }
.site-result a {
  display: block; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none;
}
.site-result a:hover, .site-result a:focus-visible { background: #efedfa; }
.site-result-title { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.4; }
.site-result-snippet { display: block; margin-top: 3px; font-size: 1.4rem; line-height: 1.6; color: rgba(0, 0, 0, .65); }
.site-result mark { background: #ffe9a8; color: inherit; border-radius: 2px; padding: 0 1px; }
.site-search-status { padding: 18px 12px; font-size: 1.5rem; color: rgba(0, 0, 0, .6); }

/* ---- 分享 ---- */
.site-share-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.site-share-title { margin: 0; font-size: 1.5rem; line-height: 1.5; color: rgba(0, 0, 0, .7); }
.site-share-row { display: flex; gap: 8px; }
.site-share-url {
  flex: 1; min-width: 0; font: inherit; font-size: 1.4rem; padding: 9px 12px;
  border: 1px solid rgba(0, 0, 0, .18); border-radius: 8px; background: #f6f6f6; color: inherit;
}
.site-btn {
  flex: none; font: inherit; font-size: 1.4rem; font-weight: 600; padding: 9px 16px;
  border-radius: 8px; border: 1px solid #15171a; background: #15171a; color: #fff; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.site-btn:hover { opacity: .88; }
.site-btn.is-ghost { background: #fff; color: #15171a; border-color: rgba(0, 0, 0, .25); }
.site-share-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.site-share-note { min-height: 1.5em; margin: 0; font-size: 1.35rem; color: #1f6b3b; }
