/*
Theme Name: Soul Dev Blog
Theme URI: https://woodduk.com
Author: Soul
Author URI: https://woodduk.com
Description: A clean, modern blog theme inspired by heisenberg.kr - featuring hero sections, card-based post grids, and a popular posts sidebar.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: soul-dev
*/

/* ======================================
   RESET & BASE
   ====================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #1a1a1a;
    background-color: #ffffff;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2563eb;
}

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

ul, ol {
    list-style: none;
}

/* ======================================
   LAYOUT
   ====================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-wrap {
    display: flex;
    gap: 40px;
    padding: 40px 0;
}

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

.content-sidebar {
    width: 400px;
    flex-shrink: 0;
}

/* ======================================
   HEADER / NAVIGATION
   ====================================== */
.site-header {
    background-color: #1a1a2e;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 999;
}

.admin-bar .site-header {
    top: 32px;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.site-logo a:hover {
    color: #ffffff;
    opacity: 0.9;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a {
    color: #d1d5db;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.main-nav a:hover,
.main-nav a.current {
    color: #ffffff;
    background-color: rgba(255,255,255,0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-actions a {
    color: #d1d5db;
    font-size: 0.85rem;
}

.header-actions a:hover {
    color: #ffffff;
}

.search-toggle,
.menu-toggle {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.search-toggle:hover,
.menu-toggle:hover {
    color: #ffffff;
}

/* Mobile nav toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #d1d5db;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ======================================
   HERO SECTION (Front page featured post)
   ====================================== */
.hero-section {
    position: relative;
    background-color: #1e293b;
    color: #ffffff;
    overflow: hidden;
}

.hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 400px;
    padding: 60px 0;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 50%;
    padding-right: 40px;
}

.hero-category {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #93c5fd;
    margin-bottom: 12px;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.hero-title a {
    color: #ffffff;
}

.hero-title a:hover {
    color: #93c5fd;
}

.hero-excerpt {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #d1d5db;
    margin-bottom: 16px;
}

.hero-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.hero-meta span + span::before {
    content: '|';
    margin: 0 8px;
}

.hero-image {
    position: absolute;
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 1;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ======================================
   POST CARDS (Grid & List)
   ====================================== */
.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1a1a1a;
    letter-spacing: -0.3px;
}

/* -- Grid card (front page latest) -- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.card {
    display: flex;
    flex-direction: column;
}

.card-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f3f4f6;
    margin-bottom: 12px;
}

.card-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-thumb img {
    transform: scale(1.03);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.card-title a:hover {
    color: #2563eb;
}

.card-excerpt {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: auto;
}

.card-meta .meta-author {
    font-weight: 600;
    color: #6b7280;
}

.card-meta .meta-category a {
    color: #2563eb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.card-meta span + span::before {
    content: '|';
    margin: 0 6px;
    color: #d1d5db;
}

/* -- Horizontal card (category sections & archive) -- */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card-horizontal {
    display: flex;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}

.card-horizontal:last-child {
    border-bottom: none;
}

.card-horizontal .card-thumb {
    width: 240px;
    min-width: 240px;
    padding-top: 0;
    height: 160px;
    margin-bottom: 0;
}

.card-horizontal .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-horizontal .card-title {
    font-size: 1.05rem;
}

.card-horizontal .card-excerpt {
    -webkit-line-clamp: 3;
}

/* -- Category section on front page -- */
.category-section {
    margin-bottom: 48px;
}

.category-section .section-title a {
    color: inherit;
}

.category-section .section-title a:hover {
    color: #2563eb;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.category-grid .card-horizontal {
    border-bottom: none;
    padding-bottom: 0;
}

.category-grid .card-horizontal .card-thumb {
    width: 200px;
    min-width: 200px;
    height: 140px;
}

.front-grid-full {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 32px 0 40px;
}

.front-mid-wrap {
    display: flex;
    gap: 40px;
    margin-bottom: 48px;
    padding-top: 8px;
}

.front-mid-left {
    flex: 1;
    min-width: 0;
}

.front-mid-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.front-mid-right {
    width: 400px;
    flex-shrink: 0;
}

/* ======================================
   POPULAR POSTS SIDEBAR
   ====================================== */
.sidebar-popular {
    position: sticky;
    top: 80px;
}

.sidebar-popular .section-title {
    font-size: 1.1rem;
}

.popular-list {
    counter-reset: popular;
}

.popular-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.popular-rank {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a1a1a;
    min-width: 28px;
    line-height: 1.2;
}

.popular-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    color: #374151;
}

.popular-title a:hover {
    color: #2563eb;
}

/* ======================================
   SINGLE POST
   ====================================== */
.single-header {
    padding: 40px 0 0;
}

.single-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.single-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #6b7280;
}

.single-meta-left .cat-link {
    color: #2563eb;
    font-weight: 600;
}

.single-meta-left .divider {
    color: #d1d5db;
}

.share-buttons {
    display: flex;
    gap: 8px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
}

.share-btn:hover {
    background-color: #f3f4f6;
    color: #1a1a1a;
}

.single-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

/* Author box */
.author-box {
    display: flex;
    gap: 20px;
    padding: 24px;
    background-color: #f9fafb;
    border-radius: 8px;
    margin-bottom: 40px;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #e5e7eb;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.author-info .author-profile-link {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 8px;
    display: inline-block;
}

.author-info .author-details {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.7;
}

/* Post content */
.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #374151;
}

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 48px 0 16px;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

.post-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 36px 0 12px;
    color: #1a1a1a;
}

.post-content p {
    margin-bottom: 20px;
}

.post-content img {
    border-radius: 4px;
    margin: 24px 0;
}

.post-content blockquote {
    border-left: 4px solid #2563eb;
    padding: 16px 20px;
    margin: 24px 0;
    background-color: #f9fafb;
    color: #4b5563;
    font-style: italic;
}

.post-content code {
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.post-content pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content ul,
.post-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin-bottom: 8px;
}

.post-content a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-color: #93c5fd;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: #1d4ed8;
}

/* Tags */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.post-tags a {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f3f4f6;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #6b7280;
    transition: all 0.2s;
}

.post-tags a:hover {
    background-color: #e5e7eb;
    color: #1a1a1a;
}

/* ======================================
   PAGINATION
   ====================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 40px;
    padding-top: 24px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: #f3f4f6;
    color: #1a1a1a;
}

.pagination .current {
    background-color: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

/* ======================================
   ARCHIVE / CATEGORY PAGE
   ====================================== */
.archive-header {
    padding: 48px 0 32px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.archive-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.archive-description {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
}

/* ======================================
   FOOTER
   ====================================== */
.site-footer {
    background-color: #1a1a2e;
    color: #9ca3af;
    padding: 48px 0 24px;
    margin-top: 64px;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.footer-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 16px;
}

.footer-nav {
    display: flex;
    gap: 20px;
}

.footer-nav a {
    font-size: 0.85rem;
    color: #9ca3af;
}

.footer-nav a:hover {
    color: #ffffff;
}

.footer-info {
    font-size: 0.8rem;
    line-height: 1.8;
    color: #6b7280;
    margin-bottom: 16px;
}

.footer-copyright {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ======================================
   SEARCH OVERLAY
   ====================================== */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-inner {
    width: 100%;
    max-width: 640px;
    padding: 0 20px;
}

.search-overlay input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.2rem;
    border: none;
    border-bottom: 2px solid #ffffff;
    background: transparent;
    color: #ffffff;
    outline: none;
}

.search-overlay input::placeholder {
    color: #9ca3af;
}

.search-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
}

/* ======================================
   NO THUMBNAIL PLACEHOLDER
   ====================================== */
.card-thumb.no-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb.no-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.4)' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ======================================
   404 PAGE
   ====================================== */
.page-404 {
    text-align: center;
    padding: 80px 0;
}

.page-404 h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.page-404 p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 24px;
}

.page-404 a {
    display: inline-block;
    padding: 12px 24px;
    background-color: #1a1a2e;
    color: #ffffff;
    border-radius: 4px;
    font-weight: 600;
}

.main-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: #1a1a2e;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 999;
}

/* ======================================
   RESPONSIVE
   ====================================== */
@media (max-width: 1024px) {
    .content-sidebar,
    .front-mid-right {
        width: 340px;
    }

    .front-grid-full {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .content-wrap,
    .front-mid-wrap {
        flex-direction: column;
    }

    .content-sidebar,
    .front-mid-right {
        width: 100%;
    }

    .hero-inner {
        min-height: 300px;
        padding: 40px 0;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-content {
        max-width: 100%;
        padding-right: 0;
    }

    .hero-image {
        width: 100%;
        opacity: 0.3;
    }

    .front-grid-full {
        grid-template-columns: 1fr;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .card-horizontal {
        flex-direction: column;
    }

    .card-horizontal .card-thumb {
        width: 100%;
        height: 200px;
    }

    .category-grid .card-horizontal .card-thumb {
        width: 100%;
        min-width: unset;
        height: 200px;
    }

    .single-title {
        font-size: 1.6rem;
    }

    .single-meta-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-top {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.3rem;
    }

    .single-title {
        font-size: 1.4rem;
    }

    .share-buttons {
        flex-wrap: wrap;
    }
}
