/* 中国民族植物学 —— 站点样式（在原站 Bootstrap 5.3 + 面包屑规则基础上的少量补充） */

/* 导航条右侧登录区 */
.site-account { flex-wrap: nowrap; }
.site-account .nav-link { padding: .5rem .5rem; white-space: nowrap; }
.site-account .btn-link { font-size: inherit; line-height: inherit; }

/* 首页图片新闻封面：保持原 175×224 尺寸，按比例裁切不再拉伸变形 */
.picture-news-cover { width: 175px; height: 224px; object-fit: cover; }


/* 专家头像：保持原 175×224 */
.expert-photo { width: 175px; height: 224px; object-fit: cover; }

/* 学习用书卡片等高（原为固定 660px 高度） */
.ebook-card .card-body { min-height: 600px; }
.ebook-cover { max-width: 100%; max-height: 300px; }

/* 列表项（原 DataList 表格 98% 宽） */
.legacy-list { width: 98%; }

/* 富文本中的图片不超出容器 */
.rich-content img { max-width: 100%; height: auto; }
.rich-content table { max-width: 100%; }

/* 窄屏：分页可换行，宽表格在容器内横向滚动（不撑宽整页） */
.pagination { flex-wrap: wrap; }

/* ---------- 显示优化 ---------- */
/* 窄屏导航条显示站点名（宽屏有横幅时隐藏） */
.site-brand { font-size: 1rem; color: #fff; }
.site-brand img { vertical-align: -6px; }


/* 关于我们：宽屏时左侧目录随页面滚动保持可见 */
@media (min-width: 768px) {
    .about-nav { position: sticky; top: 70px; }
}

/* 长拉丁名、长网址在窄屏自动换行 */
.legacy-list, .rich-content { overflow-wrap: break-word; }

/* ---------- 名称规范化信息块（植物详情页） ---------- */
.name-match { border: 1px solid #dfe5f0; background: #f7f9fc; border-radius: 4px; padding: 8px 12px; margin: 6px 0 14px; font-size: 14px; line-height: 1.9; }
.name-match .nm-label { display: inline-block; min-width: 7em; color: #37518E; font-weight: bold; }
.lang-en .name-match .nm-label { min-width: 11em; }
.name-match .nm-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 3px; font-size: 12px; background: #e3ecda; color: #2f6b2f; line-height: 1.7; }
.name-match .nm-badge.nm-fuzzy, .name-match .nm-badge.nm-ambiguous { background: #fbeed5; color: #8a5a00; }
.name-match .nm-badge.nm-synonym { background: #e2ebf7; color: #2b4f86; }
.name-match .nm-links a { margin-right: 10px; }

/* ---------- 历代方剂柱状图 ---------- */
.dynasty-chart { max-width: 680px; margin: 8px auto 0; }
.dynasty-chart figcaption { font-size: 14px; color: #37518E; font-weight: bold; text-align: center; }
.dynasty-chart svg { width: 100%; height: auto; display: block; }

/* ---------- 数据服务 / 数据概览 ---------- */
.data-card { border: 1px solid #dee2e6; border-radius: 4px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.data-card h5 { color: #37518E; font-size: 17px; margin-bottom: 4px; }
.data-card .meta { font-size: 13px; color: #6c757d; }
.data-card .excluded { font-size: 13px; color: #8a5a00; }
.tier-badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.tier-open { background: #e3ecda; color: #2f6b2f; }
.tier-controlled { background: #fbeed5; color: #8a5a00; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 10px 0 18px; }
.stat-grid .stat { border: 1px solid #dfe5f0; background: #f7f9fc; border-radius: 4px; padding: 10px; text-align: center; }
.stat-grid .stat .num { font-size: 22px; font-weight: bold; color: #37518E; }
.stat-grid .stat .lbl { font-size: 13px; color: #555; }
.figure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.figure-grid figure { border: 1px solid #eee; padding: 8px; margin: 0; background: #fff; }
.figure-grid img { width: 100%; height: auto; }
.figure-grid figcaption { font-size: 13px; color: #555; margin-top: 6px; }
.doc-section h4 { color: #37518E; margin-top: 22px; font-size: 19px; }
.doc-section pre { background: #f6f8fa; border: 1px solid #e1e4e8; padding: 10px; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.lang-switch { font-weight: bold; }
@media (max-width: 576px) {
    .figure-grid { grid-template-columns: 1fr; }
    .name-match .nm-label { min-width: 0; display: block; }
}

/* 导航：菜单文字不折行；英文菜单较长，收紧间距与字号 */
.navbar .nav-link { white-space: nowrap; }
@media (min-width: 576px) {
    .lang-en .navbar-nav .nav-link { padding-left: .35rem; padding-right: .35rem; font-size: .9rem; }
    .lang-en .site-account .nav-link { padding-left: .3rem; padding-right: .3rem; font-size: .9rem; }
}
@media (min-width: 576px) {
    .navbar-nav .nav-link { padding-left: .4rem; padding-right: .4rem; }
    .site-account .nav-link { padding-left: .3rem; padding-right: .3rem; }
}
@media (min-width: 576px) and (max-width: 1199.98px) {
    .navbar-nav .nav-link, .site-account .nav-link { padding-left: .25rem; padding-right: .25rem; font-size: .88rem; }
}

/* 宽屏：语言切换放在横幅右上角 */
.site-banner { position: relative; }
.lang-switch-banner { position: absolute; top: 6px; right: 12px; z-index: 2; color: #fff; background: rgba(55, 81, 142, .85); padding: 2px 10px; border-radius: 3px; font-size: 14px; font-weight: bold; text-decoration: none; }
.lang-switch-banner:hover { color: #fff; background: #37518E; }

/* 导航中的用户名过长时省略显示 */
.nav-user { display: inline-block; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* =====================================================================
   首页与导航外观优化（2026-10）
   ===================================================================== */

/* ---------- 导航：悬停/当前栏目指示、滚动时吸顶 ---------- */
html { scroll-padding-top: 64px; }
.site-nav-wrap { z-index: 1030; }
.site-nav { box-shadow: 0 2px 8px rgba(20, 35, 75, .18); }
.site-nav .navbar-nav .nav-link { position: relative; border-radius: 4px; transition: background-color .15s ease; }
.site-nav .navbar-nav .nav-link::after {
    content: ""; position: absolute; left: 22%; right: 22%; bottom: 3px; height: 2px; border-radius: 2px;
    background: #fff; transform: scaleX(0); transition: transform .2s ease;
}
.site-nav .navbar-nav .nav-link:hover,
.site-nav .navbar-nav .nav-link:focus-visible { background-color: rgba(255, 255, 255, .12); }
.site-nav .navbar-nav .nav-link:hover::after,
.site-nav .navbar-nav .nav-link:focus-visible::after,
.site-nav .navbar-nav .nav-link.active::after { transform: scaleX(1); }
.site-nav .navbar-nav .nav-link.active { background-color: rgba(255, 255, 255, .18); font-weight: 600; }
.site-nav a:focus-visible, .site-nav button:focus-visible { outline: 2px solid #ffd666; outline-offset: 2px; }
.site-account a:hover, .site-account .btn-link:hover { text-decoration: underline !important; }
.site-account-cta { border: 1px solid rgba(255, 255, 255, .7); border-radius: 999px; padding: 1px 11px; }
.site-account-cta:hover { background: #fff; color: #37518E !important; text-decoration: none !important; }
@media (max-width: 575.98px) {
    .site-nav .navbar-collapse { padding: .25rem 0 .5rem; }
    .site-nav .navbar-nav .nav-link { padding: .6rem .75rem; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    .site-nav .navbar-nav .nav-link::after { left: 0; right: auto; top: 22%; bottom: 22%; width: 3px; height: auto; transform: scaleY(0); }
    .site-nav .navbar-nav .nav-link:hover::after,
    .site-nav .navbar-nav .nav-link.active::after { transform: scaleY(1); }
    .site-account { flex-wrap: wrap; }
}

/* ---------- 首页检索 ---------- */
.home-search-band {
    background: linear-gradient(135deg, #37518E 0%, #2b4174 100%);
    color: #fff; padding: 22px 16px 16px; margin-top: 6px; border-radius: 6px 6px 0 0;
}
#home-search { max-width: 780px; margin: 0 auto; }
.search-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.search-tab-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.search-tab {
    cursor: pointer; user-select: none; padding: 4px 15px; border-radius: 999px; font-size: 14px; line-height: 1.6;
    color: rgba(255, 255, 255, .88); border: 1px solid rgba(255, 255, 255, .35); transition: background-color .15s, color .15s, border-color .15s;
}
.search-tab:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.search-tab-input:checked + .search-tab { background: #fff; color: #37518E; border-color: #fff; font-weight: 600; }
.search-tab-input:focus-visible + .search-tab { outline: 2px solid #ffd666; outline-offset: 2px; }
.search-box {
    position: relative; display: flex; align-items: center; background: #fff; border-radius: 999px;
    padding: 4px 4px 4px 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); transition: box-shadow .15s;
}
.search-box:focus-within { box-shadow: 0 0 0 3px rgba(255, 214, 102, .7), 0 6px 18px rgba(0, 0, 0, .2); }
.search-box-icon { color: #8a94a6; flex: 0 0 auto; }
.search-box-input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: #222; padding: 9px 10px; font-size: 16px; }
.search-box-input::placeholder { color: #9aa3b2; }
.search-box-submit {
    flex: 0 0 auto; border: 0; border-radius: 999px; background: #3d8b57; color: #fff; font-size: 16px; font-weight: 600;
    padding: 8px 26px; transition: background-color .15s;
}
.search-box-submit:hover { background: #317349; }
.search-box-submit:focus-visible { outline: 2px solid #ffd666; outline-offset: 2px; }
.search-suggest {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1040; list-style: none; margin: 0; padding: 6px 0;
    background: #fff; border-radius: 10px; box-shadow: 0 12px 28px rgba(0, 0, 0, .22); max-height: 380px; overflow-y: auto; text-align: left;
}
.search-suggest-item { display: flex; align-items: baseline; gap: 14px; padding: 7px 18px; cursor: pointer; color: #222; font-size: 15px; }
.search-suggest-item .sg-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-suggest-item .sg-sub { flex: 0 1 45%; color: #6c757d; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-style: italic; }
.search-suggest-item.active, .search-suggest-item:hover { background: #eef2fa; }
.search-suggest-all { color: #37518E; font-size: 14px; border-top: 1px solid #eceff4; margin-top: 4px; padding-top: 9px; }
.search-examples { margin-top: 12px; text-align: center; font-size: 13px; color: rgba(255, 255, 255, .85); }
.search-chip {
    border: 1px solid rgba(255, 255, 255, .4); background: transparent; color: #fff; border-radius: 999px;
    padding: 1px 11px; margin: 2px 3px; font-size: 13px; transition: background-color .15s;
}
.search-chip:hover { background: rgba(255, 255, 255, .16); }
.search-chip:focus-visible { outline: 2px solid #ffd666; outline-offset: 1px; }
.search-tagline { margin: 12px 0 0; text-align: center; font-size: 14px; color: rgba(255, 255, 255, .92); letter-spacing: .02em; }
@media (max-width: 575.98px) {
    .home-search-band { padding: 16px 10px 12px; border-radius: 0; }
    .search-tab { padding: 3px 10px; font-size: 13px; }
    .search-box { padding-left: 10px; }
    .search-box-input { font-size: 15px; padding: 8px 6px; }
    .search-box-submit { padding: 7px 16px; font-size: 15px; }
}

/* ---------- 首页统计块 ---------- */
.home-stats { display: grid; grid-template-columns: repeat(5, 1fr); border-radius: 0 0 6px 6px; overflow: hidden; }
.home-stat-card {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 104px; padding: 14px 18px;
    color: #fff; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.home-stat-card.stat-c0 { background: #4467f1; }
.home-stat-card.stat-c1 { background: #3a8ad8; }
a.home-stat-card[href]:hover, a.home-stat-card[href]:focus-visible {
    color: #fff; z-index: 1; transform: translateY(-3px); filter: brightness(1.07); box-shadow: 0 8px 18px rgba(0, 0, 0, .2);
}
a.home-stat-card[href]:focus-visible { outline: 2px solid #ffd666; outline-offset: -4px; }
.home-stat-icon { width: 52px; height: 52px; object-fit: contain; flex: 0 0 auto; }
.home-stat-text { display: flex; flex-direction: column; min-width: 0; }
.home-stat-label { font-size: 14px; opacity: .92; line-height: 1.3; }
.home-stat-num { font-size: 28px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 991.98px) {
    .home-stats { grid-template-columns: repeat(3, 1fr); }
    .home-stat-card { min-height: 88px; }
    .home-stat-num { font-size: 23px; }
}
@media (max-width: 575.98px) {
    .home-stats { grid-template-columns: repeat(2, 1fr); border-radius: 0; }
    .home-stat-card { min-height: 76px; padding: 10px 12px; gap: 8px; }
    .home-stat-icon { width: 36px; height: 36px; }
    .home-stat-label { font-size: 12.5px; }
    .home-stat-num { font-size: 20px; }
}

/* ---------- 首页特色有用植物 ---------- */
.home-section-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 28px 0 14px; }
.home-section-title { color: #37518E; margin: 0; text-align: center; font-size: 1.5rem; }
.home-section-title::after { content: ""; display: block; width: 46px; height: 3px; margin: 7px auto 0; border-radius: 2px; background: #3d8b57; }
.home-section-actions { justify-self: end; display: flex; gap: 2px; align-items: center; }
#shuffle-plants svg { vertical-align: -2px; margin-right: 2px; }
#shuffle-plants.is-busy svg { animation: home-spin .8s linear infinite; }
@keyframes home-spin { to { transform: rotate(360deg); } }
.featured-grid { transition: opacity .2s ease; }
.featured-grid.is-loading { opacity: .45; pointer-events: none; }
.plant-tile {
    display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 8px; background: #e3e9e3;
    color: #263a2d; text-decoration: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); transition: transform .2s ease, box-shadow .2s ease;
}
.plant-tile:hover, .plant-tile:focus-visible { color: #263a2d; transform: translateY(-4px); box-shadow: 0 10px 22px rgba(0, 0, 0, .16); }
.plant-tile:focus-visible { outline: 3px solid #37518E; outline-offset: 2px; }
.plant-tile-img { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #d4ddd5; }
.plant-tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.plant-tile:hover .plant-tile-img img, .plant-tile:focus-visible .plant-tile-img img { transform: scale(1.06); }
.plant-tile-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 12px; }
.plant-tile-title { font-size: 1.15rem; font-weight: 600; color: #37518E; line-height: 1.35; overflow-wrap: anywhere; }
.plant-tile-sub { font-size: .9rem; color: #56635a; line-height: 1.35; overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
    .home-section-head { grid-template-columns: 1fr; }
    .home-section-head > span:first-child { display: none; }
    .home-section-actions { justify-self: center; margin-top: 8px; }
}
@media (max-width: 575.98px) {
    .plant-tile-body { padding: 8px 10px 10px; }
    .plant-tile-title { font-size: 1rem; }
    .plant-tile-sub { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    .site-nav .navbar-nav .nav-link::after, .home-stat-card, .plant-tile, .plant-tile-img img, .featured-grid { transition: none; }
    .plant-tile:hover, a.home-stat-card[href]:hover { transform: none; }
    .plant-tile:hover .plant-tile-img img { transform: none; }
    #shuffle-plants.is-busy svg { animation: none; }
}
