/* ==========================================
   Developer Diary (ブログ機能) カスタムCSS
   ========================================== */

/* 全体背景とコンテナ微調整 */
body {
    background-color: #f8f9fa;
}

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

/* 1. ブログヘッダー (モヤ学ブログをベースに中央寄せ) */
.diary-header {
    text-align: center;
    padding: 3rem 1rem 3.5rem 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #eef1f5;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.diary-header-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.diary-header-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.diary-header-title a:hover {
    color: #0d6efd;
}

.diary-header-description {
    font-size: 0.95rem;
    color: #555555;
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 400;
}

/* 2. 記事カードグリッド (はてなブログPC版再現) */
.diary-card {
    background: #ffffff;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), 
                box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    cursor: pointer;
}

.diary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* カード画像ラッパー & ズームアニメーション */
.diary-card-img-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background-color: #f1f3f5;
}

.diary-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.diary-card:hover .diary-card-img {
    transform: scale(1.05);
}

/* カード本文 */
.diary-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* カテゴリーバッジスタイル */
.diary-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    width: fit-content;
}

.diary-badge-update {
    background-color: #e8f4fd;
    color: #0d6efd;
}

.diary-badge-ai_tech {
    background-color: #f3e8ff;
    color: #8b5cf6;
}

.diary-badge-notice {
    background-color: #fff3cd;
    color: #856404;
}

.diary-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    /* 2行までに制限 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.diary-card-title a {
    color: inherit;
    text-decoration: none;
}

.diary-card-title a::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.diary-card-excerpt {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
    /* 3行までに制限 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.diary-card-date {
    font-size: 0.75rem;
    color: #adb5bd;
    font-weight: 500;
    margin-top: auto;
}

/* 3. サイドバーのスタイリング */
.sidebar-section {
    background: #ffffff;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #eef1f5;
    position: relative;
}

/* タイトルの下にアクセントラインを引く */
.sidebar-title::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: #0d6efd;
}

/* 最近の記事リスト (小さなサムネイル + タイトル) */
.sidebar-recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-recent-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px dashed #e9ecef;
}

.sidebar-recent-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.sidebar-recent-thumb {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 6px;
    background-color: #f1f3f5;
    flex-shrink: 0;
}

.sidebar-recent-content {
    flex-grow: 1;
    min-width: 0;
}

.sidebar-recent-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s ease;
}

.sidebar-recent-link:hover {
    color: #0d6efd;
}

.sidebar-recent-date {
    font-size: 0.7rem;
    color: #adb5bd;
    margin-top: 0.25rem;
}

/* カテゴリーリスト */
.sidebar-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-category-item {
    margin-bottom: 0.5rem;
}

.sidebar-category-item:last-child {
    margin-bottom: 0;
}

.sidebar-category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-category-link:hover,
.sidebar-category-link.active {
    background-color: #f1f3f5;
    color: #0d6efd;
}

.sidebar-category-count {
    font-size: 0.75rem;
    background-color: #e9ecef;
    color: #6c757d;
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
    font-weight: 700;
}

.sidebar-category-link:hover .sidebar-category-count,
.sidebar-category-link.active .sidebar-category-count {
    background-color: #e8f4fd;
    color: #0d6efd;
}

/* プロフィールウィジェット */
.profile-card {
    text-align: center;
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #eef1f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 0.75rem auto;
    border: 2px solid #eef1f5;
}

.profile-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.profile-bio {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 0;
}

/* 4. 記事詳細ページのスタイリング */
.diary-post-container {
    background: #ffffff;
    border: 1px solid #eef1f5;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.diary-post-header {
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.diary-post-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.diary-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: #6c757d;
}

.diary-post-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.diary-post-body {
    font-size: 0.95rem;
    color: #333333;
    line-height: 1.8;
}

.diary-post-body p {
    margin-bottom: 1.5rem;
}

.diary-post-body blockquote {
    border-left: 4px solid #0d6efd;
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    color: #555555;
    border-radius: 0 8px 8px 0;
}

.diary-post-body h4, 
.diary-post-body h5 {
    color: #1a1a1a;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.diary-post-body ul, 
.diary-post-body ol {
    margin-bottom: 1.5rem;
}

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

/* レスポンシブ調整 */
@media (max-width: 991.98px) {
    .diary-header {
        padding: 2rem 1rem 2.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    .diary-header-title {
        font-size: 1.8rem;
    }
    .diary-post-container {
        padding: 1.5rem;
    }
    .diary-post-title {
        font-size: 1.5rem;
    }
}

/* 5. 前後の記事ナビゲーション */
.diary-post-divider {
    border-top: 1px solid #eef1f5;
    margin: 2.5rem 0 1.5rem 0;
    opacity: 0.8;
}

.diary-post-navigation {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1.5rem;
}

.diary-post-nav-left,
.diary-post-nav-right {
    flex: 1;
    min-width: 0;
}

.diary-post-nav-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-decoration: none;
}

.diary-post-nav-link:hover {
    background-color: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 8px 16px rgba(13, 110, 253, 0.08);
    transform: translateY(-3px);
}

.diary-post-nav-disabled {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 1.25rem;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
    background-color: #f8fafc;
    opacity: 0.55;
    cursor: not-allowed;
}

.diary-post-nav-label {
    font-size: 0.75rem;
    color: #888888;
    margin-bottom: 0.35rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.diary-post-nav-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2c3e50;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.diary-post-nav-link:hover .diary-post-nav-title {
    color: #0d6efd;
}


