/* ==========================================================================
   头号英语 - 公共样式（首页 + 博客共用）
   单一来源：所有页面应引用此文件，保证视觉一致
   ========================================================================== */

/* CSS Variables - 设计令牌 */
:root {
    --background: 220 20% 4%;
    --foreground: 210 20% 92%;
    --card: 220 18% 8%;
    --primary: 22 100% 50%;
    --primary-foreground: 0 0% 100%;
    --secondary: 220 16% 14%;
    --muted: 220 14% 12%;
    --muted-foreground: 215 12% 50%;
    --border: 220 14% 16%;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Space Grotesk', 'Noto Sans SC', system-ui, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==========================================================================
   Buttons - 统一样式（所有页面必须一致）
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    background-color: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
}

.btn-outline:hover {
    background-color: hsl(var(--secondary));
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    height: 3rem;
}

/* ==========================================================================
   Navbar - 公共导航栏
   ========================================================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 4rem;
    background: hsl(var(--card) / 0.6);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid hsl(var(--border) / 0.3);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 2rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
}

.logo-img {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background-image: url('logo.png');
    background-size: cover;
    background-position: center;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
}

.nav-links {
    display: none;
    gap: 2rem;
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-links a {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: hsl(var(--foreground));
}

.nav-links a.active {
    opacity: 1;
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: hsl(var(--primary));
    border-radius: 1px;
}

.nav-links a {
    opacity: 0.7;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.icon-sm {
    width: 1rem;
    height: 1rem;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.fade-in.fade-in-pending {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s, transform 0.6s;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.glass-card {
    background: hsl(var(--background) / 0.95);
    backdrop-filter: blur(20px);
}

/* ── Back to Top 按钮 ─────────────────────────────────────────────── */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(1rem);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 16px -4px hsl(var(--primary) / 0.4);
}

.back-to-top:hover {
    background: hsl(var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -4px hsl(var(--primary) / 0.5);
}

.back-to-top:active {
    transform: translateY(0);
}

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

@media (max-width: 767px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 2.75rem;
        height: 2.75rem;
    }
}

/* ── Modal 弹窗 ─────────────────────────────────────────────── */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: hsl(var(--background) / 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    overflow-y: auto;
    animation: modal-fade-in 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 1.5rem;
    max-width: 48rem;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modal-slide-up 0.3s ease;
}

@keyframes modal-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid hsl(var(--border));
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: hsl(var(--secondary));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: hsl(var(--muted-foreground));
}

.modal-close:hover {
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
}

/* ── Modal Body & Contact Styles ──────────────────────────────── */

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    color: hsl(var(--primary));
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    color: hsl(var(--muted-foreground));
    line-height: 1.8;
    margin-bottom: 1rem;
}

.modal-body ul {
    color: hsl(var(--muted-foreground));
    line-height: 1.8;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.contact-info {
    background: hsl(var(--secondary));
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid hsl(var(--border));
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-icon {
    width: 40px;
    height: 40px;
    background: hsl(var(--primary) / 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.contact-text {
    flex: 1;
}

.contact-text strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.contact-text a {
    color: hsl(var(--primary));
    text-decoration: none;
}

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