/* ===================================================================
   标准法律 · 首页样式 (home.css)
   风格：藏青学术典雅 —— 衬线字体、纸面质感（与 calculator.css 同体系）
   =================================================================== */

:root {
    --navy-deep: #071d30;
    --navy: #1b4a72;
    --navy-hover: #12385a;
    --navy-soft: rgba(27, 74, 114, 0.07);
    --khaki: #b3a592;
    --khaki-strong: #9a8a72;
    --khaki-soft: rgba(179, 165, 146, 0.16);
    --paper: #f4f0e6;
    --ivory: #fdfbf5;
    --ivory-dim: #f8f4ea;
    --text-primary: #26313b;
    --text-secondary: #66707a;
    --line: #ddd5c4;
    --line-strong: rgba(7, 29, 48, 0.35);
    --max-width: 1200px;
    --radius-small: 4px;
    --radius-medium: 6px;
    --serif: Georgia, "Times New Roman", "Songti SC", "STSong",
        "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--serif);
    background-color: var(--paper);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    padding-top: 52px; /* 适配固定导航栏 */
}

::selection {
    background: var(--khaki-soft);
    color: var(--navy-deep);
}

/* ---------- 导航栏（纸面 + 双细线） ---------- */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 52px;
    background: var(--paper);
    z-index: 1000;
    border-bottom: 3px double var(--line-strong);
}

.nav-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 clamp(14px, 3vw, 24px);
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.12em;
    text-decoration: none;
    color: var(--navy-deep);
}

.logo img {
    height: 30px;
    width: auto;
    display: block;
}

.navbar-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.navbar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 0.05em;
    padding: 7px 12px;
    border-radius: var(--radius-small);
    transition: all 0.22s ease;
}

.navbar-nav a:hover {
    color: var(--navy);
    background: var(--khaki-soft);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--navy-deep);
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    font-family: var(--serif);
}

/* ---------- 法律声明弹窗 ---------- */
.legal-notice-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 29, 48, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.legal-notice-modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--ivory);
    border: 1px solid var(--line);
    border-radius: var(--radius-medium);
    padding: clamp(22px, 4vw, 32px);
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(7, 29, 48, 0.3);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--navy-deep);
    letter-spacing: 0.08em;
}

.modal-text {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 22px;
    color: var(--text-primary);
}

.modal-confirm {
    background: var(--navy);
    color: #f6f2e9;
    border: 1px solid var(--navy-deep);
    border-radius: var(--radius-small);
    padding: 12px 24px;
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: background 0.22s ease;
    width: 100%;
    min-height: 46px;
}

.modal-confirm:hover {
    background: var(--navy-hover);
}

/* ---------- Hero 主视觉区 ---------- */
header {
    padding: clamp(52px, 9vw, 88px) 20px clamp(40px, 7vw, 64px);
    text-align: center;
    background: transparent;
}

header h1 {
    font-size: clamp(30px, 6vw, 44px);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--navy-deep);
    margin-bottom: 14px;
}

/* 标题下的卡其饰线 */
header h1::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    margin: 16px auto 0;
    border-top: 1px solid var(--khaki-strong);
    border-bottom: 1px solid var(--khaki-strong);
}

header p {
    font-size: clamp(16px, 2.5vw, 19px);
    color: var(--text-secondary);
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    max-width: 600px;
    margin: 0 auto;
}

/* ---------- 搜索框 ---------- */
.search-container {
    max-width: 600px;
    margin: clamp(28px, 5vw, 40px) auto 0;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--radius-medium);
    border: 1px solid var(--line);
    background: var(--ivory);
    font-family: var(--serif);
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.22s ease;
    min-height: 48px;
}

.search-input::placeholder {
    color: #a49a89;
}

.search-input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(27, 74, 114, 0.14);
}

/* ---------- 主体布局 ---------- */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px clamp(14px, 3vw, 24px) 20px;
}

.section-title {
    font-size: clamp(20px, 3vw, 25px);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--navy-deep);
    margin: clamp(30px, 5vw, 44px) 0 18px;
    padding-left: 12px;
    border-left: 4px solid var(--navy);
    position: relative;
}

/* 分类标题下的浅卡其延长线 */
.section-title::after {
    content: "";
    position: absolute;
    left: 16px;
    bottom: -8px;
    width: 120px;
    height: 1px;
    background: var(--khaki-strong);
    opacity: 0.6;
}

/* ---------- 工具卡片网格 ---------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 14px;
}

.tool-card {
    background: var(--ivory);
    border-radius: var(--radius-medium);
    padding: 20px 18px 16px;
    padding-top: 38px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    border: 1px solid var(--line);
    position: relative;
}

.tool-card:hover {
    border-color: var(--navy);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(7, 29, 48, 0.1);
}

.tool-card h3 {
    font-size: 16.5px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--navy-deep);
    word-break: break-all;
    line-height: 1.45;
    letter-spacing: 0.02em;
}

.tool-tag {
    position: absolute;
    top: 11px;
    right: 12px;
    font-size: 11px;
    color: var(--navy);
    background: var(--khaki-soft);
    border: 1px solid rgba(179, 165, 146, 0.4);
    padding: 1px 7px;
    border-radius: 2px;
    letter-spacing: 0.08em;
    white-space: nowrap;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card .arrow {
    color: var(--navy);
    font-size: 13.5px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    letter-spacing: 0.04em;
}

/* ---------- 回到顶部 ---------- */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--navy);
    color: #f6f2e9;
    border: 1px solid var(--navy-deep);
    border-radius: var(--radius-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ---------- 页脚 ---------- */
footer {
    background: var(--navy-deep);
    border-top: 3px double var(--khaki);
    padding: 40px 20px;
    margin-top: clamp(50px, 8vw, 76px);
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: 0;
    border-top: none;
}

.footer-links {
    display: flex;
    gap: 8px 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    letter-spacing: 0.05em;
    padding: 4px 2px;
}

.footer-links a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
    color: #fff;
}

.copyright {
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
}

.copyright a {
    color: var(--khaki);
    text-decoration: none;
}

.copyright a:hover {
    text-decoration: underline;
}

.footer-beian {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 18px;
}

.footer-beian a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

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

.beian-icon {
    width: 14px;
    height: auto;
}

/* ---------- 平板 ---------- */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }

    .scroll-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* ---------- 手机 ---------- */
@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .navbar-nav {
        position: absolute;
        top: 52px;
        right: 0;
        background: var(--ivory);
        flex-direction: column;
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 6px 16px rgba(7, 29, 48, 0.12);
        display: none;
        align-items: stretch;
    }

    .navbar-nav.visible {
        display: flex;
    }

    .navbar-nav a {
        padding: 12px 20px;
        border-radius: 0;
    }

    .nav-toggle {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
