/* Modern Design System - Light & Dark Theme */

/* CSS Variables for Light Theme */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f4f4f5;
    --text-primary: #09090b;
    --text-secondary: #3f3f46;
    --text-muted: #71717a;
    --text-light: #a1a1aa;
    --border-primary: #e4e4e7;
    --border-secondary: #d4d4d8;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --gradient-secondary: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    --gradient-accent: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-destructive: #f43f5e;
    --color-destructive-hover: #e11d48;
    --footer-bg: linear-gradient(135deg, #18181b 0%, #09090b 100%);
    --footer-text: #fafafa;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #e4e4e7;
    --text-muted: #a1a1aa;
    --text-light: #71717a;
    --border-primary: #27272a;
    --border-secondary: #3f3f46;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #e879f9 100%);
    --gradient-secondary: linear-gradient(135deg, #3f3f46 0%, #52525b 100%);
    --gradient-accent: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    --color-primary: #818cf8;
    --color-primary-hover: #6366f1;
    --color-destructive: #fb7185;
    --color-destructive-hover: #f43f5e;
    --footer-bg: linear-gradient(135deg, #27272a 0%, #18181b 100%);
    --footer-text: #fafafa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

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

/* Header - Modern & Clean */
header {
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

header .container {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

header h1 a {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.2s;
    display: inline-block;
}

header h1 a:hover {
    opacity: 0.8;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
    transform: scale(1.05);
}

/* Main Content */
main {
    padding: 0;
    min-height: calc(100vh - 200px);
    background: var(--bg-secondary);
}

main.container {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding: 2.5rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.75rem;
    margin-bottom: 3rem;
}

/* Card Component */
.post-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #c4b5fd;
}

.post-card:active {
    transform: translateY(-2px);
}

.post-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--gradient-secondary);
    position: relative;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-image img {
    transform: scale(1.08);
}

.post-content {
    padding: 1.5rem;
}

.post-content h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.post-content p {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Meta */
.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.post-meta > span,
.post-meta > a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.post-meta .views,
.post-meta .time {
    font-variant-numeric: tabular-nums;
}

.post-meta .category-chip {
    margin-left: auto;
}

/* Badge/Chip */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--gradient-secondary);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: 1px solid var(--border-primary);
    letter-spacing: 0.01em;
}

.category-chip:hover {
    background: var(--gradient-accent);
    border-color: #a78bfa;
    color: #5b21b6;
    transform: translateY(-1px);
}

[data-theme="dark"] .category-chip:hover {
    color: #e9d5ff;
}

/* Post Detail */
.post-detail {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.post-detail h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.post-detail .post-meta {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-primary);
}

.post-image-full {
    margin: 2rem 0;
    text-align: center;
    border-radius: 12px;
    overflow: hidden;
}

.post-image-full img {
    margin: 0 auto;
    border-radius: 12px;
    max-height: 600px;
    object-fit: contain;
    box-shadow: var(--shadow-md);
}

.post-body {
    font-size: 1.0625rem;
    line-height: 1.8;
    margin: 2.5rem 0;
    color: var(--text-primary);
}

.post-source {
    margin: 2rem 0;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
}

[data-theme="dark"] .post-source {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-left-color: #fbbf24;
}

.post-source a {
    color: #b45309;
    font-weight: 600;
    transition: all 0.2s;
}

[data-theme="dark"] .post-source a {
    color: #fde68a;
}

.post-source a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Ad Container - Coupang Partners */
.ad-container {
    margin: 2rem 0;
    padding: 0;
    background: transparent;
    text-align: center;
}

.ad-container a,
.ad-container iframe {
    display: inline-block;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
}

.ad-container img {
    margin: 0 auto;
    border-radius: 8px;
}

.ad-disclaimer {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-light);
    text-align: center;
    font-weight: 400;
    opacity: 0.85;
}

.post-actions {
    margin-top: 2.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Button Component */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-back:hover {
    opacity: 0.9;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

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

.btn-like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    border: 2px solid var(--border-primary);
    cursor: pointer;
}

.btn-like:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: #a78bfa;
    color: #7c3aed;
    transform: translateY(-2px);
}

.btn-like:active:not(:disabled) {
    transform: translateY(0);
}

.btn-like.liked {
    background: linear-gradient(135deg, var(--color-destructive) 0%, var(--color-destructive-hover) 100%);
    color: #ffffff;
    border-color: var(--color-destructive);
    box-shadow: 0 4px 6px -1px rgba(244, 63, 94, 0.3);
}

.btn-like.liked:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 10px 15px -3px rgba(244, 63, 94, 0.4);
}

.btn-like:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-like .like-icon {
    font-size: 1.125rem;
}

.btn-like .like-count {
    font-variant-numeric: tabular-nums;
}

/* Post Navigation - Previous/Next */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0;
}

.post-navigation a {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    transition: all 0.2s;
    min-height: 5rem;
}

.post-navigation a:hover {
    border-color: #a78bfa;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-navigation .nav-label {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-weight: 500;
}

.post-navigation .nav-title {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-navigation .nav-prev {
    text-align: left;
}

.post-navigation .nav-next {
    text-align: right;
}

/* Hot Posts Section */
.hot-posts-section {
    margin: 3rem 0 2rem;
    padding: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
}

.hot-posts-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hot-posts-list {
    display: grid;
    gap: 0.75rem;
}

.hot-post-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    transition: all 0.2s;
}

.hot-post-item:hover {
    border-color: #a78bfa;
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.hot-post-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.hot-post-content {
    flex: 1;
    min-width: 0;
}

.hot-post-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.hot-post-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 0;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    min-width: 3rem;
}

.pagination a:hover {
    background: var(--bg-tertiary);
    border-color: #a78bfa;
    color: #7c3aed;
    transform: translateY(-2px);
}

.pagination a:active {
    transform: translateY(0);
}

.current-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9375rem;
    min-width: 3rem;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

/* Footer */
footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-primary);
}

footer p {
    font-size: 0.9375rem;
    opacity: 0.7;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .post-detail {
        padding: 1.75rem;
    }

    .post-detail h1 {
        font-size: 1.75rem;
    }

    .post-content {
        padding: 1.25rem;
    }

    .post-body {
        font-size: 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    main.container {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
        padding: 1.75rem 1rem;
        border-radius: 16px;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .hot-posts-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    header .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.375rem;
    }

    .post-detail {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .post-content h2 {
        font-size: 1.0625rem;
    }

    .post-card {
        border-radius: 10px;
    }

    main.container {
        margin-top: 1rem;
        margin-bottom: 1rem;
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
}

/* Smooth animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.3s ease-out;
}
