/* ========================================
   디자인 시스템 - 변수 & 기본 설정
   ======================================== */
:root {
    /* Premium Palette: Clean Minimalist White */
    --bg-primary: #FAFAFA;
    --bg-secondary: #F5F5F5;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --border-card: rgba(0, 0, 0, 0.04);
    --text-primary: #1d1d1f;
    /* Apple-style dark gray */
    --text-secondary: #6e6e73;
    /* Apple-style light gray */

    /* Accent Glows (Subtle) */
    --glow-purple: rgba(140, 122, 230, 0.06);
    --glow-teal: rgba(0, 184, 148, 0.06);
    --accent-blue: #0071e3;

    --radius-card: 22px;
    /* Smoother corners */

    /* Layered Shadows for depth */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

    --transition-base: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ========================================
   리셋 & 기본 스타일
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    /* Tighter typography */
}

/* ========================================
   배경 효과 (Mesh Gradient & Grain)
   ======================================== */
.page-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 10%, var(--glow-purple), transparent 40%),
        radial-gradient(circle at 90% 90%, var(--glow-teal), transparent 40%),
        var(--bg-primary);
    animation: auraMove 15s ease-in-out infinite alternate;
}

/* Subtle grain texture overlay */
.page-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

@keyframes auraMove {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1) translate(1%, 1%);
    }
}

/* ========================================
   헤더 및 언어 토글
   ======================================== */
.header {
    padding: 100px 32px 60px;
    text-align: center;
    position: relative;
}

.lang-toggle-container {
    position: absolute;
    top: 24px;
    right: 32px;
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-card);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.logo-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0071e3 0%, #00d2ff 100%);
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 113, 227, 0.2), inset 0 0 10px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    animation: floating 4s ease-in-out infinite;
    letter-spacing: -0.5px;
}

.logo-badge::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 45%, rgba(255, 255, 255, 0.1) 50%, transparent 55%);
    animation: shine 6s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }

    100% {
        transform: translateX(100%) translateY(100%);
    }
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.logo-text {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1.5px;
    margin-left: -2px;
}

.logo-text {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-primary) 30%, #444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-sub {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 400;
    opacity: 0.8;
}

/* ========================================
   메인 컨테이너 & 카테고리
   ======================================== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 40px 100px;
}

.category-section {
    margin-bottom: 80px;
}

.category-header {
    margin-bottom: 32px;
}

.category-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.category-title i {
    width: 26px;
    height: 26px;
    stroke-width: 2px;
    color: var(--cat-color);
}

/* Remove chunky border, use subtle indicator */
.category-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 30px;
    height: 3px;
    background: var(--cat-color);
    border-radius: 2px;
    opacity: 0.6;
}

/* ========================================
   그리드 레이아웃
   ======================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

/* ========================================
   카드 스타일 (Premium Glassmorphism)
   ======================================== */
.card {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    text-decoration: none;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.card:hover {
    transform: translateY(-6px) scale(1.01);
    background: var(--bg-card-hover);
    border-color: rgba(var(--cat-rgb), 0.15);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(var(--cat-rgb), 0.05);
}

.card:active {
    transform: scale(0.98);
}

/* ========================================
   카드 내용
   ======================================== */
.card-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    transition: transform var(--transition-base);
    overflow: hidden;
}

.card-icon img {
    padding: 4px;
}

.card:hover .card-icon {
    transform: scale(1.1) rotate(-3deg);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    transition: color 0.3s;
}

/* Remove title underline for cleaner look */
.card-title::after {
    display: none;
}

.card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    opacity: 0.85;
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card:hover .card-title {
    color: var(--cat-color);
}

/* ========================================
   푸터
   ======================================== */
.footer {
    text-align: center;
    padding: 60px 32px 100px;
    color: var(--text-secondary);
    font-size: 15px;
    opacity: 0.6;
}

/* ========================================
   애니메이션 & 트랜지션
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-section {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.category-section:nth-child(1) {
    animation-delay: 0.1s;
}

.category-section:nth-child(2) {
    animation-delay: 0.2s;
}

.category-section:nth-child(3) {
    animation-delay: 0.3s;
}

.category-section:nth-child(4) {
    animation-delay: 0.4s;
}

.category-section:nth-child(5) {
    animation-delay: 0.5s;
}

.category-section:nth-child(6) {
    animation-delay: 0.6s;
}

/* ========================================
   반응형 디자인
   ======================================== */
@media (max-width: 768px) {
    .header {
        padding: 60px 24px 40px;
    }

    .logo-text {
        font-size: 32px;
    }

    .container {
        padding: 0 24px 60px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 22px;
    }
}

/* ========================================
   접근성
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    ::before,
    ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}