@charset "UTF-8";

/* =========================================
   1. Variables (Light / Dark Theme)
   ※1回目の温かみのあるソフトな配色をベースに復元
========================================= */
:root {
    /* Light Theme */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --border-color: #e2e8f0;
    --code-bg: #1e293b;
    --code-text: #f8fafc;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Theme */
        --bg-color: #0f172a;
        --surface-color: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --primary-color: #60a5fa;
        --primary-hover: #93c5fd;
        --border-color: #334155;
        --code-bg: #000000;
        --code-text: #f8fafc;
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    }
}

/* =========================================
   2. Base Styles & Typography
========================================= */
*, *::before, *::after {
    box-sizing: border-box;
    word-break: break-word;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: sans-serif;
    font-size: 16px;
    line-height: 1.8;
    width: 92%;
    max-width: 800px; /* 記事が横に広がりすぎないよう制限 */
    margin: 0 auto;
    padding: 32px 0 64px 0;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration-color: var(--primary-hover);
}

img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 32px 0;
    /* 角丸を廃止しシャープに */
    border-radius: 0; 
}

/* =========================================
   3. Header & Navigation
========================================= */
header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 32px;
    gap: 16px;
}

#headerTitle {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

#headerTitle a {
    color: var(--text-main);
    text-decoration: none;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

nav a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

nav a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* =========================================
   4. Post Meta Data (タグの控えめ化)
========================================= */
#meta {
    margin: 82px 0;
    display: flex;
    flex-direction: column;
}

#postTitle {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.post_meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* タグデザイン：背景・枠線を完全に消し、テキストリンク化 */
.post_meta a {
    color: var(--text-muted);
    background-color: transparent; /* 背景色なし */
    border: none; /* 枠線なし */
    padding-left: 4px;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
}

/* カンマ（,）の非表示または薄くする対応
   ※ HTML構造上、タグとタグの間に直接カンマテキストが存在するため、
   CSSだけでカンマのみを薄くすることはできません。
   そのため、タグ自体の見た目を極力テキストに近づけて違和感を減らします */

.post_meta a:hover {
    color: var(--primary-color);
    text-decoration: underline; /* ホバー時のみ下線を表示してリンクであることを示す */
    text-underline-offset: 2px;
}

/* =========================================
   5. Main Content Typography & Elements
========================================= */
#main h1, #main h2, #main h3, #main h4, #main h5, #main h6 {
    color: var(--text-main);
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 16px;
    line-height: 1.4;
}

/* 見出しサイズのバランス（2回目の調整を維持） */
#main h1 { font-size: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 12px; }
#main h2 { font-size: 1.6rem; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
#main h3 { font-size: 1.3rem; }
#main h4 { font-size: 1.15rem; }

/* H5, H6 の視認性確保 */
#main h5 { font-size: 1.1rem; }
#main h6 { 
    font-size: 1rem; 
    color: var(--text-main); 
    border-left: 4px solid var(--border-color);
    padding-left: 12px;
}

#main p {
    margin-bottom: 24px;
}

/* Lists */
#main ul, #main ol {
    padding-left: 24px;
    margin-bottom: 24px;
}

#main li {
    margin-bottom: 8px;
}

#main li > ul, #main li > ol {
    margin-top: 8px;
    margin-bottom: 0;
}

/* Blockquotes (1回目の温かみのある配色を復元・角はシャープ) */
blockquote {
    margin: 32px 0;
    padding: 16px 24px;
    background-color: var(--surface-color);
    border-left: 4px solid var(--primary-color);
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

blockquote blockquote {
    margin: 16px 0 0 0;
    box-shadow: none;
    background-color: var(--bg-color);
    border-left: 4px solid var(--border-color);
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* Code & Pre (文字サイズ1rem、可読性重視のダーク背景) */
pre {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 20px 24px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1rem;
    margin: 32px 0;
    box-shadow: var(--shadow-md); /* 1回目のシャドウを復元 */
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: var(--surface-color);
    color: var(--text-main);
    padding: 2px 6px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

pre code {
    background-color: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: 1em;
}

/* Tables (横スクロール対応を維持) */
table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap; /* 強制改行オフ */
    border-collapse: collapse;
    margin: 32px 0;
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

th {
    background-color: rgba(0, 0, 0, 0.02);
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    th { background-color: rgba(255, 255, 255, 0.03); }
}

/* =========================================
   6. Custom Cards (Info, Link, Article)
   ※1回目の配色・シャドウを復元しつつ、角丸を0に
========================================= */
/* Info Card */
.info_card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--primary-color);
    padding: 20px 24px;
    margin: 32px 0;
}

.info_card > span:first-child {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Link Card */
.link_card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    margin: 32px 0;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    text-decoration: none; /* カード内は下線オフ */
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.link_card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.link_card > span:first-child {
    font-weight: 700;
    font-size: 1.1rem;
}

.link_card > span:last-child {
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* Link Card image/text layout fix */
.link_card {
    gap: 24px;
}

.link_card img {
    width: 160px;
    min-width: 160px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    margin: 0;
}

.link_card > div {
    flex: 1;
    min-width: 0;
}

.link_card .card-title,
.link_card .card-description {
    overflow-wrap: break-word;
}

.link_card img,
.card-article img {
    max-width: none;
}

/* Article Card (Post Card) */
a.card-article {
    display: flex;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin: 4px 0;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

a.card-article:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
}

a.card-article > img {
    width: 30%;
    min-width: 150px;
    flex-shrink: 0;
    margin: 0;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

a.card-article > div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    gap: 8px;
}

a.card-article .art-title {
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

a.card-article .art-meta {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 600px) {
    a.card-article {
        flex-direction: column;
    }
    
    a.card-article > img {
        width: 100%;
        aspect-ratio: 2/1;
        border-bottom: 1px solid var(--border-color);
    }
    
    a.card-article > div {
        padding: 16px;
    }
}

/* =========================================
   7. Footer
========================================= */
footer {
    margin-top: 80px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}