/*
Theme Name: my-template
Description: Modern clean theme for ozlabjp
Version: 1.2
Author: ozlab
*/

:root {
    --primary-color: #3b82f6;
    --text-color: #24292f;
    --text-muted: #57606a;
    --bg-color: #f6f8fa;
    --sidebar-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --container-max-width: 1100px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 24px;
}

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

aside {
    width: 280px;
    flex-shrink: 0;
}

/* Header */
header {
    background: #fff;
    border-bottom: 1px solid #d0d7de;
    padding: 16px 0; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
header .container {
    display: flex;
    justify-content: center;
    padding-top: 5px;
    padding-bottom: 5px;
}
header img {
    height: 32px;
}

/* Post Cards (Index) */
.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.post-card {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    box-shadow: 0 8px 24px rgba(149,157,165,0.2);
}
.post-card-img-wrapper {
    width: 100%;
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    border-bottom: 1px solid #d0d7de;
}
.post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-card-content {
    padding: 16px;
    flex: 1;
}
.post-card h2 {
    font-size: 1.1rem;
    margin: 0 0 8px;
    line-height: 1.4;
}
.post-card h2 a {
    color: var(--text-color);
    text-decoration: none;
}
.post-card h2 a:hover {
    color: var(--primary-color);
}
.post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Sidebar Widgets */
.widget {
    background: #fff;
    padding: 20px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    margin-bottom: 20px;
}
.widget-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.widget-title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Table of Contents */
.toc {
    top: 40px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.toc ul {
    list-style: none;
    padding-left: 0;
    font-size: 0.85rem;
}
.toc li {
    margin-bottom: 8px;
}
.toc a {
    color: var(--text-muted);
    text-decoration: none;
}
.toc a:hover, .toc a.active {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Article Content */
.article-container {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 40px;
}
.entry-content h2 {
    border-bottom: 1px solid #d0d7de;
    padding-bottom: 8px;
    margin-top: 40px;
}

@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }
    aside {
        width: 100%;
    }
    .toc {
        position: static;
        margin-bottom: 24px;
    }
}

/* Blockquote */
.entry-content blockquote {
    margin: 24px 0;
    padding: 16px 20px;
    background-color: #f1f5f9;
    border-left: 5px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.entry-content blockquote p {
    margin: 0;
}
.entry-content blockquote a {
    color: var(--primary-color);
    text-decoration: none;
}
.entry-content blockquote a:hover {
    text-decoration: underline;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    /* 記事詳細の余白を減らす */
    .article-container {
        padding: 20px 16px;
    }
    
    /* 見出しのサイズ調整 */
    .article-container h1 {
        font-size: 1.5rem !important;
    }
    .entry-content h2 {
        font-size: 1.3rem;
        margin-top: 30px;
    }
    .entry-content h3 {
        font-size: 1.1rem;
    }

    /* 引用ブロックの余白を減らす */
    .entry-content blockquote {
        padding: 12px 16px;
        margin: 20px 0;
    }

    /* トップページカードの調整 (はみ出し防止) */
    .post-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* コンテナの左右余白調整 */
    .container {
        padding: 16px 12px;
    }
}

/* Zenn-like Article Body Styles */
.entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
}
.entry-content p {
    margin: 1.5em 0;
}
.entry-content h2 {
    font-size: 1.6rem;
    padding-bottom: 0.5em;
    border-bottom: 2px solid #eef2f7;
    margin-top: 2.5em;
    margin-bottom: 1em;
}
.entry-content h3 {
    font-size: 1.3rem;
    margin-top: 2em;
    margin-bottom: 0.8em;
    display: flex;
    align-items: center;
}
.entry-content h3::before {
    content: "■";
    color: var(--primary-color);
    font-size: 0.8em;
    margin-right: 0.5em;
}
.entry-content ul, .entry-content ol {
    padding-left: 2em;
    margin: 1.2em 0;
}
.entry-content li {
    margin-bottom: 0.6em;
}
.entry-content strong {
    background: linear-gradient(transparent 70%, #dbeafe 70%);
}

/* 目次のみを固定する設定 */
.toc {
    position: -webkit-sticky;
    position: sticky;
    top: 40px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 10;
}
