/**
 * Joycewemtek 公共样式
 * 包含 CSS 变量定义、重置样式、通用组件
 */

/* ==================== CSS Variables ==================== */
:root {
    /* Colors */
    --primary-bg: #FAFAFC;
    --secondary-bg: #f5f5f7;
    --accent-blue: #0071e3;
    --accent-blue-hover: #0077ED;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --header-bg: #FAFAFC;
    --white: #FFFFFF;
    --black: #000000;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    --font-size-hero: 56px;
    --font-size-h1: 40px;
    --font-size-h2: 28px;
    --font-size-h3: 20px;
    --font-size-body: 17px;
    --font-size-small: 12px;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 48px;
    --spacing-xl: 80px;
    --spacing-section: 120px;

    /* Animation */
    --transition-fast: 200ms ease;
    --transition-normal: 300ms ease-out;
    --transition-slow: 500ms ease-in-out;

    /* Layout */
    --max-width: 1080px;
    --header-height: 48px;
}

/* ==================== CSS Reset ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--primary-bg);
    overflow-x: hidden;
}

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

ul, ol {
    list-style: none;
}

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

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* ==================== Typography ==================== */
h1, .h1 {
    font-size: var(--font-size-h1);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2, .h2 {
    font-size: var(--font-size-h2);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h3, .h3 {
    font-size: var(--font-size-h3);
    font-weight: 600;
    line-height: 1.3;
}

p {
    margin-bottom: 1em;
}

p:last-child {
    margin-bottom: 0;
}

/* ==================== Layout ==================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.page-content {
    min-height: calc(100vh - var(--header-height));
    padding-top: var(--header-height);
}

/* ==================== Loading ==================== */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Utility Classes ==================== */
.text-center {
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==================== Page Transitions ==================== */
.page-enter {
    opacity: 0;
    transform: translateY(10px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.page-leave {
    opacity: 1;
}

.page-leave-active {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    :root {
        --font-size-hero: 36px;
        --font-size-h1: 28px;
        --font-size-h2: 22px;
        --font-size-h3: 18px;
        --font-size-body: 15px;
        --spacing-section: 80px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --font-size-hero: 48px;
        --font-size-h1: 34px;
    }
}

@media (min-width: 1440px) {
    :root {
        --max-width: 1200px;
    }
}
