@import 'variables.css';

/* ===================== Base ===================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--text-main);
    background: var(--bg-white);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--primary);
}

h1, h2, h3 {
    margin: 0;
    font-family: Georgia, serif;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    /*padding: 0 0 50px;*/
}

section {
    margin-top: 32px;
}

/* ===================== Navigation ===================== */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

p.nav-logo {
    margin: 0;
    font-size: 0;
    white-space: nowrap;
}

.nav-logo a {
    text-decoration: none;
}

.nav-logo .logo-the,
.nav-logo .logo-names {
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 1px;
    vertical-align: middle;
}

.nav-logo .logo-prime {
    font-family: Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    vertical-align: middle;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    background: transparent;
    transition: background 0.15s ease;
}

.nav-link:hover {
    background: #f0f0f0;
}

.nav-link.is-active {
    background: var(--accent-red);
    color: #ffffff;
    border-radius: 4px;
}

/* Hamburger button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    position: relative;
    cursor: pointer;
    z-index: 1000;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle span {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.nav-toggle span::before {
    top: -8px;
    left: 0;
}

.nav-toggle span::after {
    bottom: -8px;
    left: 0;
}

.nav-toggle.active span {
    background: transparent;
}

.nav-toggle.active span::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle.active span::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* ===================== Back to Top ===================== */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    font-size: 18px;
}

.back-to-top:hover {
    background: var(--primary-dark);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===================== Footer ===================== */
.footer {
    background: #111111;
    color: #cccccc;
    padding: 40px 0 0;
    margin-top: 40px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 40px;
    justify-content: space-between;
    font-size: 14px;
    flex-wrap: wrap;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col strong {
    color: #ffffff;
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.footer-col a {
    color: #aaaaaa;
    font-size: 13px;
    transition: color 0.15s;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bot {
    max-width: 1200px;
    margin: 30px auto 0;
    border-top: 1px solid #333;
    padding: 16px 0 20px;
    text-align: center;
    font-size: 13px;
    color: #777;
}

/* ===================== Breadcrumb ===================== */
.breadcrumb {
    padding: 12px 0;
    margin-bottom: 16px;
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb li a {
    color: var(--text-muted);
}

.breadcrumb li a:hover {
    color: var(--primary);
}

.breadcrumb li:not(:last-child)::after {
    content: "›";
    margin: 0 6px;
    color: #999;
}

.breadcrumb li:last-child {
    color: var(--text-main);
}

/* ===================== Container (inner pages) ===================== */
.page-wrapper .container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===================== Sidebar ===================== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: #f8f8f8;
    border-radius: 4px;
    padding: 16px;
}

.widget-title {
    font-family: Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    letter-spacing: 0.5px;
}

.sidebar-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-item__img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 3px;
}

.sidebar-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-item__body {
    flex: 1;
    min-width: 0;
}

.sidebar-item__cat {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}

.sidebar-item__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sidebar-item__title:hover {
    color: var(--primary);
}

/* ===================== Pagination ===================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    gap: 4px;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.pagination a,
.pagination span {
    padding: 6px 10px;
    color: var(--text-main);
}

.pagination a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.pagination .active {
    font-weight: 700;
    text-decoration: underline;
    color: var(--text-main);
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

.pagination .ellipsis {
    padding: 6px 4px;
}

/* ===================== Article Category Tag ===================== */
.cat-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.8px;
    display: inline-block;
    margin-bottom: 6px;
}

/* ===================== Responsive ===================== */
@media(max-width:1200px){
    .nav-inner,
    .page-wrapper,
    .footer-inner {
        padding: 0 16px;
    }
}
@media (max-width: 1024px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: hidden;
        max-height: 0;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: var(--bg-white);
        box-shadow: 0 6px 20px rgba(0,0,0,0.1);
        padding: 0 16px;
        z-index: 100;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .nav-menu.active {
        max-height: 400px;
        padding: 16px;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 10px;
        font-size: 15px;
    }

    .page-wrapper .container {
        grid-template-columns: 1fr;
    }

    /* 移动端各容器左右边距 */
    .nav-inner {
        padding: 0 16px;
    }

    .page-wrapper {
        padding: 0 16px;
    }

    .footer-inner {
        padding: 0 16px;
    }

    .footer-bot {
        padding: 16px 16px 20px;
    }
}

@media (max-width: 768px) {
    .nav-inner {
        padding: 0 16px;
    }

    .page-wrapper {
        padding: 0 16px 40px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 20px;
        padding: 0 16px;
    }

    .footer-bot {
        padding: 16px 16px 20px;
    }
}