/* ============================================================
   layout.css —— 页面布局 / 站点头部 / 站点页脚 / 公共侧边栏
   依赖：variables.css、base.css、components.css
   ============================================================ */

/* ---------- 区块与栅格（页面通用骨架） ---------- */
.section {
    padding: 84px 0
}
.section.alt {
    background: var(--surface)
}
.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 29px
}
.section-head h2 {
    margin: 10px 0 7px;
    font-size: clamp(27px, 3.6vw, 40px);
    letter-spacing: -1.2px;
    line-height: 1.28
}
.section-head p {
    margin: 0;
    color: var(--muted)
}
.link-arrow {
    font-weight: 750;
    color: var(--brand);
    white-space: nowrap
}
.link-arrow:hover {
    color: var(--accent)
}
.grid {
    display: grid;
    gap: 22px
}
.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr))
}
.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr))
}
.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr))
}

/* ============================================================
   站点头部 Header（includes/header.php）
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line)
}
.header-inner {
    height: var(--header);
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: space-between
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0
}
.logo-symbol {
    width: 40px;
    height: 40px;
    border-radius: 12px 12px 12px 3px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 23px;
    font-style: italic
}
.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.23
}
.logo-text strong {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: .2px;
    color: var(--brand)
}
.logo-text small {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .65px;
    color: var(--muted);
    margin-top: 5px
}
.nav {
    display: flex;
    gap: 26px;
    align-items: center
}
.nav a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 680;
    white-space: nowrap;
    position: relative;
    transition: .2s
}
.nav a:hover {
    color: var(--brand)
}
.nav a.active,
.nav a.is-current,
.nav a[aria-current="page"] {
    color: var(--brand);
    font-weight: 800
}
.nav a.active:after,
.nav a.is-current:after,
.nav a[aria-current="page"]:after {
    content: "";
    position: absolute;
    bottom: -27px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--brand);
    border-radius: 2px
}
.nav a:focus-visible,
.mobile-menu a:focus-visible {
    outline: 3px solid #ff765b;
    outline-offset: 5px;
    border-radius: 3px
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px
}
.mobile-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 8px;
    color: var(--brand)
}
.mobile-menu {
    display: none;
    background: #fff;
    border-top: 1px solid var(--line)
}
.mobile-menu.is-open {
    display: block
}
.mobile-menu a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-weight: 650
}
.mobile-menu a.active,
.mobile-menu a.is-current,
.mobile-menu a[aria-current="page"] {
    color: var(--brand);
    background: #eff0fa;
    font-weight: 800;
    border-left: 3px solid var(--brand);
    padding-left: 13px
}
.mobile-menu .btn {
    margin: 16px 0
}

/* ============================================================
   站点页脚 Footer（includes/footer.php）
   ============================================================ */
.site-footer {
    background: var(--brand-deep);
    color: #fff;
    margin-top: 0
}
.footer-top {
    padding: 65px 0 47px;
    display: grid;
    grid-template-columns: 1.7fr repeat(3, 1fr);
    gap: 52px
}
.footer-about p {
    max-width: 330px;
    color: #afb6d5;
    font-size: 13px;
    line-height: 1.9;
    margin: 20px 0
}
.footer-col h4 {
    font-size: 14px;
    margin: 0 0 18px
}
.footer-col a {
    display: block;
    color: #aeb5d1;
    font-size: 13px;
    margin: 10px 0
}
.footer-col a:hover {
    color: #fff
}
.footer-bottom {
    border-top: 1px solid #32395c;
    padding: 20px 0;
    color: #aeb5d1;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px
}
.footer-bottom a {
    color: inherit
}
.footer-logo {
    display: flex;
    gap: 12px;
    align-items: center
}
.footer-logo .logo-symbol {
    background: #fff;
    color: var(--brand)
}
.footer-logo strong {
    font-size: 21px
}
.footer-logo small {
    display: block;
    color: #adb6d8;
    font-size: 12px;
    letter-spacing: 1.2px
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 20;
    width: 43px;
    height: 43px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    color: var(--brand);
    box-shadow: var(--shadow);
    display: none
}
.back-to-top.show {
    display: block
}

/* ============================================================
   公共侧边栏（includes/sidebar.php）
   页面通过 $sidebar_items 传入：[['label'=>'','href'=>'','active'=>false], ...]
   ============================================================ */
.sidebar {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    background: #fff
}
.sidebar-title {
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 0 0 14px
}
.sidebar a {
    display: block;
    font-size: 13px;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 7px
}
.sidebar a:hover {
    color: var(--brand);
    background: var(--brand-light)
}
.sidebar a.active,
.sidebar a[aria-current="location"] {
    background: #ecedfa;
    color: var(--brand);
    font-weight: 750
}
.sidebar-label {
    display: block;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 1px;
    color: var(--subtle);
    padding: 12px 10px 4px
}
