/* BESS SERVICE 全站公共框架样式（Story 1.1，对齐 Figma 设计稿）
   设计基准：Header 1920x81 白底；Footer #141E1A；主绿 #5C9434；正文灰绿 #43493C；字体 Manrope。 */

@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope-latin.101877a7a906.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --bess-green: #5C9434;
    --bess-ink: #43493C;
    --bess-footer-bg: #141E1A;
    --bess-footer-text: #E2E3D9;
    --bess-placeholder: #6B7280;
    --bess-border: #E5E7EB;
    --bess-font: "Manrope", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--bess-font);
    font-size: 15px;
    color: var(--bess-ink);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------- 顶部导航 */
.site-header {
    background: #fff;
    border-bottom: 1px solid #E5E8E2;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header__inner {
    max-width: 1880px;
    margin: 0 auto;
    height: 81px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-header__logo { display: inline-flex; align-items: center; flex: none; }
.site-header__logo img { height: 52px; width: auto; display: block; }

/* 桌面导航组 */
.site-nav { display: flex; align-items: center; gap: 32px; }

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--bess-ink);
    line-height: 26px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-link:hover { color: var(--bess-green); }

.nav-link.is-active {
    color: var(--bess-green);
    font-weight: 600;
    border-bottom-color: var(--bess-green);
}

/* 下拉（Services / 语言 / 头像共用结构） */
.nav-dropdown { position: relative; }

.nav-dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--bess-ink);
    line-height: 26px;
    padding: 4px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.nav-dropdown__toggle:hover { color: var(--bess-green); }
.nav-dropdown__toggle.is-active {
    color: var(--bess-green);
    font-weight: 600;
    border-bottom-color: var(--bess-green);
}

.nav-dropdown__caret {
    width: 8px;
    height: 5px;
    flex: none;
    transition: transform 0.15s ease;
}

.nav-dropdown.is-open .nav-dropdown__caret { transform: rotate(180deg); }

.nav-dropdown__menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--bess-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(20, 30, 26, 0.12);
    display: none;
}

.nav-dropdown.is-open .nav-dropdown__menu { display: block; }

.nav-dropdown__menu a,
.nav-dropdown__menu button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--bess-ink);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-dropdown__menu a:hover,
.nav-dropdown__menu button:hover {
    color: var(--bess-green);
    background: #F4F8F0;
}

/* 语言切换（地球图标 + 当前语言码） */
.nav-lang__globe { width: 14px; height: 14px; flex: none; }

/* 登录按钮（未登录态）：白底绿字绿框 */
.nav-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 34px;
    padding: 0 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--bess-green);
    border: 1.5px solid var(--bess-green);
    border-radius: 8px;
    white-space: nowrap;
}

.nav-login:hover { background: var(--bess-green); color: #fff; }

/* 头像（已登录态） */
.nav-avatar__circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #CCCCCC;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.nav-avatar__circle--photo {
    object-fit: cover;
    background: #ebf3e8;
    padding: 0;
}

/* 全局 messages（base.html） */
.site-messages { padding-top: 16px; }
.site-message {
    margin: 0 0 8px; padding: 12px 16px;
    font-size: 14px; border-radius: 8px;
    background: #f4f8f0; border: 1px solid #dfe9d2; color: #3c6420;
}
.site-message--error { background: #fdf0ee; border-color: #f2d2cc; color: #8a2f22; }
.site-message--warning { background: #fdf6e7; border-color: #f0dfb8; color: #8a5a00; }

/* 汉堡按钮（移动端） */
.nav-burger {
    display: none;
    width: 40px;
    height: 40px;
    padding: 9px;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}

.nav-burger span {
    display: block;
    height: 2px;
    background: var(--bess-ink);
    border-radius: 1px;
}

/* ---------------------------------------------------------- 页脚 */
.site-footer {
    background: var(--bess-footer-bg);
    color: var(--bess-footer-text);
}

.site-footer__inner {
    max-width: 1768px;
    margin: 0 auto;
    padding: 72px 40px 0;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.site-footer__brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 20px;
}

.site-footer__heading {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.site-footer__list { list-style: none; margin: 0; padding: 0; }
.site-footer__list li { margin-bottom: 12px; }
.site-footer__list a { font-size: 15px; color: var(--bess-footer-text); }
.site-footer__list span { font-size: 15px; color: var(--bess-footer-text); }
.site-footer__list a:hover { color: #fff; }
.site-footer__list a.is-active { color: #fff; }

.site-footer__news-text { font-size: 15px; line-height: 1.7; margin: 0 0 20px; }

.site-footer__subscribe { display: flex; gap: 8px; }

.site-footer__subscribe input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    color: var(--bess-ink);
    background: #fff;
    border: none;
    border-radius: 6px;
}

.site-footer__subscribe input::placeholder { color: var(--bess-placeholder); }

.site-footer__subscribe button {
    position: relative;
    height: 38px;
    padding: 0 18px;
    font: inherit;
    font-size: 12px;
    color: #fff;
    background: var(--bess-green);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.site-footer__subscribe button:hover { filter: brightness(1.08); }
.site-footer__subscribe button:disabled { cursor: default; }
.site-footer__subscribe button.is-loading { pointer-events: none; }
.site-footer__subscribe button.is-loading .site-footer__subscribe-label { visibility: hidden; }
.site-footer__subscribe-spin { display: none; }
.site-footer__subscribe button.is-loading .site-footer__subscribe-spin {
    display: block;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: site-footer-spin .6s linear infinite;
}
@keyframes site-footer-spin {
    to { transform: rotate(360deg); }
}

.site-footer__subscribe-msg {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--bess-footer-text);
}
.site-footer__subscribe-msg.is-error { color: #fff; }

.site-footer__bottom {
    max-width: 1768px;
    margin: 48px auto 0;
    padding: 20px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 15px;
}

.site-footer__legal { display: flex; gap: 32px; }
.site-footer__legal a { color: var(--bess-footer-text); text-decoration: none; }
.site-footer__legal a:hover { color: #fff; }
.site-footer__legal span { color: var(--bess-footer-text); }

/* Cookie 授权条：贴底白底，主色与 LOGIN / 订阅按钮同一套 token */
.cookie-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: #fff;
    border-top: 1px solid var(--bess-border);
    box-shadow: 0 -12px 32px rgba(20, 30, 26, 0.08);
}
.cookie-bar__inner {
    max-width: 1880px;
    margin: 0 auto;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.cookie-bar__title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--bess-ink);
}
.cookie-bar__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--bess-placeholder);
    max-width: 720px;
}
.cookie-bar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}
.cookie-bar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 38px;
    padding: 0 18px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.cookie-bar__btn--primary {
    color: #fff;
    background: var(--bess-green);
    border: 1.5px solid var(--bess-green);
}
.cookie-bar__btn--primary:hover { filter: brightness(1.08); }
.cookie-bar__btn--ghost {
    color: var(--bess-green);
    background: #fff;
    border: 1.5px solid var(--bess-green);
}
.cookie-bar__btn--ghost:hover { background: var(--bess-green); color: #fff; }
body.cookie-bar-open { padding-bottom: 160px; }

/* 友情链接（Admin 可管）：排在 BESS SERVICE 标题下 */
.site-footer__friend-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
}
.site-footer__friend-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--bess-footer-text);
}
.site-footer__friend-link:hover { color: #fff; }
.site-footer__friend-logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

/* ---------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
    .site-header__inner { padding: 0 24px; }
    .site-nav { gap: 22px; }
}

@media (max-width: 1024px) {
    .nav-burger { display: flex; }

    /* 导航组改为整屏抽屉 */
    .site-nav {
        position: fixed;
        inset: 80px 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 12px 24px 24px;
        background: #fff;
        border-bottom: 1px solid var(--bess-border);
        box-shadow: 0 24px 48px rgba(20, 30, 26, 0.12);
        display: none;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .site-nav.is-open { display: flex; }

    .nav-link,
    .nav-dropdown__toggle {
        font-size: 15px;
        padding: 12px 0;
        border-bottom: 1px solid var(--bess-border);
    }

    .nav-dropdown__menu {
        position: static;
        transform: none;
        border: none;
        box-shadow: none;
        padding: 0 0 0 16px;
    }

    .nav-login { margin-top: 16px; align-self: flex-start; }

    .site-footer__grid { grid-template-columns: repeat(2, 1fr); }
    .cookie-bar__inner { padding: 20px 24px; }
}

@media (max-width: 640px) {
    /* 小屏头部更紧凑，确保 logo + 汉堡同排不溢出 */
    .site-header__inner { padding: 0 16px; height: 64px; }
    .site-header__logo img { height: 40px; }

    .site-nav { inset: 64px 0 auto 0; max-height: calc(100vh - 64px); }

    .site-footer__inner { padding: 48px 24px 0; }
    .site-footer__grid { grid-template-columns: 1fr; gap: 32px; }
    .site-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 24px;
    }
    .cookie-bar__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    .cookie-bar__actions { width: 100%; }
    .cookie-bar__btn { flex: 1; min-width: 0; }
    body.cookie-bar-open { padding-bottom: 240px; }
}
