/*
Theme Name: 于心之言
Theme URI: https://github.com/xinyan
Author: 于欣岩
Author URI: #
Description: 个人博客主题，三栏极简现代风格，支持文字与摄影双板块。
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: xinyan
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;500&family=Noto+Sans+SC:wght@300;400;500&family=DM+Sans:ital,wght@0,300;0,400;1,300&display=swap');

/* ══════════════════════════════════════
   CSS 变量
══════════════════════════════════════ */
:root {
  --bg: #f8f8f8;
  --panel: #ffffff;
  --border: #e2e2e2;
  --border-strong: #c8c8c8;
  --ink: #111111;
  --ink-2: #484848;
  --ink-3: #909090;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-mid: #bfdbfe;
  --header-h: 58px;
  --sidebar-l: 220px;
  --sidebar-r: 230px;
  --gap: 12px;
}

/* ══════════════════════════════════════
   Reset & Base
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ══════════════════════════════════════
   Header
══════════════════════════════════════ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--gap);
  z-index: 200;
  gap: var(--gap);
}

.header-brand-cell {
  width: var(--sidebar-l);
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 20px;
}

.site-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-decoration: none;
}

.site-byline {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 300;
  color: var(--ink-3);
  font-style: italic;
}

.header-center-cell { flex: 1; min-width: 0; }

.header-nav-cell {
  width: var(--sidebar-r);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  gap: 4px;
}

.header-nav-cell a {
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-2);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 5px;
  transition: all 0.15s;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.header-nav-cell a:hover {
  background: var(--bg);
  border-color: var(--border);
}

.header-nav-cell a.current-menu-item,
.header-nav-cell a.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 400;
}

/* ══════════════════════════════════════
   三栏布局
══════════════════════════════════════ */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h) - 54px);
  gap: var(--gap);
  padding: var(--gap);
  align-items: flex-start;
}

/* ══════════════════════════════════════
   公共卡片
══════════════════════════════════════ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.card-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.card-action {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.card-body { padding: 14px 18px; }

/* ══════════════════════════════════════
   左侧栏
══════════════════════════════════════ */
.sidebar-left {
  width: var(--sidebar-l);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + var(--gap));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 300;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.sidebar-nav li a:hover { background: var(--bg); color: var(--ink); }

.sidebar-nav li a.current-cat,
.sidebar-nav li a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 400;
}

.nav-count {
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.sidebar-nav li a.current-cat .nav-count,
.sidebar-nav li a.active .nav-count {
  background: var(--accent-mid);
  border-color: var(--accent-mid);
  color: var(--accent);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }

.tag-cloud a,
.tag {
  font-size: 14px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
  text-decoration: none;
}

.tag-cloud a:hover,
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row:first-child { padding-top: 0; }
.info-label { color: var(--ink-3); }
.info-value { color: var(--ink); font-weight: 400; }

/* ══════════════════════════════════════
   主内容列
══════════════════════════════════════ */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Tab 条 */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--panel);
}

.tab {
  padding: 13px 0;
  margin-right: 28px;
  font-size: 14px;
  font-weight: 300;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 400; }

/* 文章头部 */
.post-header {
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--border);
}

.content-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--accent-mid);
  text-decoration: none;
}

.entry-title,
.content-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.content-meta {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--ink-3);
}

.meta-sep { margin: 0 10px; color: var(--border-strong); }

/* 正文 */
.post-body-wrap { padding: 28px; }

.entry-content,
.post-body {
  font-size: 15px;
  line-height: 2;
  color: #222;
  letter-spacing: 0.04em;
}

.entry-content p,
.post-body p { margin-bottom: 24px; }

.entry-content h2,
.entry-content h3 {
  font-family: 'Noto Serif SC', serif;
  font-weight: 400;
  margin: 36px 0 16px;
  color: var(--ink);
}

.entry-content h2 { font-size: 20px; }
.entry-content h3 { font-size: 17px; }

.entry-content blockquote,
.post-body .lead {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  color: var(--ink);
  font-weight: 300;
  line-height: 1.9;
  margin-bottom: 32px;
  padding: 16px 20px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
}

.entry-content img {
  border-radius: 6px;
  margin: 20px 0;
  border: 1px solid var(--border);
}

.entry-content figure { margin: 24px 0; }
.entry-content figcaption {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
  letter-spacing: 0.08em;
}

.wp-block-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 24px 0;
}

/* 文章列表 */
.article-list { display: flex; flex-direction: column; }

.article-row {
  display: flex;
  align-items: flex-start;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  gap: 16px;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}

.article-row:hover { background: var(--bg); }

.article-date {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  padding-top: 3px;
  min-width: 44px;
  font-family: 'DM Sans', sans-serif;
}

.article-info { flex: 1; }

.article-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.6;
  margin-bottom: 6px;
}

.article-excerpt {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.7;
}

.article-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-3);
  margin-top: 7px;
  letter-spacing: 0.05em;
}

.article-thumb {
  width: 68px; height: 68px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
}

/* 摄影相册 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
}

.gallery-item {
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s;
}

.gallery-item:hover { border-color: var(--accent); }

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 0;
  border: none;
  margin: 0;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 55%);
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  opacity: 0;
  transition: opacity 0.18s;
}

.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-overlay span { font-size: 12px; color: #fff; letter-spacing: 0.08em; }

/* ══════════════════════════════════════
   右侧栏
══════════════════════════════════════ */
.sidebar-right {
  width: var(--sidebar-r);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + var(--gap));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.related-list { list-style: none; }

.related-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.related-item:last-child { border-bottom: none; }
.related-item:hover { background: var(--bg); }
.related-item a { text-decoration: none; display: block; }

.r-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.r-title {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.55;
  font-family: 'Noto Serif SC', serif;
  font-weight: 300;
  margin-bottom: 4px;
}

.r-date {
  font-size: 12px;
  color: var(--ink-3);
  font-family: 'DM Sans', sans-serif;
}

.thumb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 18px;
}

.thumb {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 0.15s;
  overflow: hidden;
  background: var(--bg);
}

.thumb:hover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.archive-list { list-style: none; }

.archive-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.archive-list li:last-child a { border-bottom: none; }
.archive-list li a:hover { background: var(--bg); }

.archive-count {
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
}

/* ══════════════════════════════════════
   页脚
══════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
}

.footer-copy {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.footer-beian a {
  font-size: 12px;
  color: var(--ink-3);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.15s;
}

.footer-beian a:hover { color: var(--ink); }

/* ══════════════════════════════════════
   分页
══════════════════════════════════════ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  transition: all 0.15s;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ══════════════════════════════════════
   滚动条
══════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ══════════════════════════════════════
   ICP备案
══════════════════════════════════════ */
  </main><!-- .main-col -->

  <?php get_sidebar( 'right' ); ?>

</div><!-- .layout -->

<footer class="site-footer">
  <div class="footer-copy">
    © <?php echo date( 'Y' ); ?> 于欣岩 · <?php bloginfo( 'name' ); ?>
  </div>
  <div class="footer-links">
    <a href="<?php bloginfo( 'rss2_url' ); ?>">RSS</a>
    <a href="<?php echo esc_url( get_permalink( get_page_by_path( 'about' ) ) ); ?>">关于</a>
  </div>
  <div class="footer-beian">
    <a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
      苏ICP备2025160600号
    </a>
  </div>
</footer>

<?php wp_footer(); ?>
</body>
</html>

/* ══════════════════════════════════════
   响应式适配（手机 / 平板）
══════════════════════════════════════ */

/* 平板：≤ 1024px，隐藏右侧栏 */
@media ( max-width: 1024px ) {
  .sidebar-right { display: none; }
  .main-col { max-width: 100%; }
  :root { --sidebar-l: 200px; }
}

/* 手机：≤ 768px，三栏变单栏 */
@media ( max-width: 768px ) {

  .sidebar-left,
  .sidebar-right { display: none; }

  .layout {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }

  .site-header { padding: 0 16px; gap: 8px; }

  .header-brand-cell {
    width: auto;
    flex: 1;
    padding: 0;
  }

  .header-center-cell { display: none; }

  .header-nav-cell {
    width: auto;
    padding: 0;
    gap: 2px;
  }

  .header-nav-cell a {
    font-size: 12px;
    padding: 4px 8px;
  }

  .main-col { width: 100%; }

  .post-header { padding: 20px 16px 16px; }

  .content-title,
  .entry-title { font-size: 21px; }

  .post-body-wrap { padding: 16px; }

  .entry-content,
  .post-body { font-size: 15px; line-height: 1.9; }

  .entry-content blockquote,
  .post-body .lead { font-size: 15px; padding: 12px 14px; }

  .article-row { padding: 16px; gap: 12px; }
  .article-thumb { width: 56px; height: 56px; }

  .gallery-grid {
    grid-template-columns: repeat( 2, 1fr );
    padding: 10px;
    gap: 6px;
  }

  .about-layout { grid-template-columns: 1fr; }

  .about-avatar {
    width: 100%;
    aspect-ratio: 2/1;
  }

  .site-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 16px;
  }
}